Monday, June 13, 2011

How to get the Entity Type Code in CRM 2011

In CRM 4.0 you can get the ObjectTypeCode by using crmForm.ObjectTypeCode. Unfortunately, in CRM 2011 there is no explicit method in the Xrm namespace that returns the EntityTypeCode/ObjectTypeCode.  However, you can easily get the EntityTypeCode by using the Xrm.Page.context.getQueryStringParameters() method. This method will return an object with properties for each parameter in the query string. So to get the EntityTypeCode you would write something like
//var etc = Entity Type Code of active record
var etc = Xrm.Page.context.getQueryStringParameters().etc

No comments:

Post a Comment