Cry about...
Dynamics CRM 2011 How To


How to get type of regardingobjectid entity (JavaScript or C#)


JavaScript

To retrieve the logical entity name of the entity referenced by regardingobjectid you can use the following JavaScript:

var regardingObjectID = window.Xrm.Page.getAttribute("regardingobjectid").getValue();

var logicalEntityName = regardingObjectID[0].entityType;

C#

Or to retrieve the logical entity name using C#:

EntityReference entityReference = (EntityReference)entity["regardingobjectid"];

string logicalEntityName = regardingRef.LogicalName;


These notes have been tested with Microsoft Dynamics CRM 2011, and may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.