var getObjectTypeCode = function(entityName) {
var lookupService = new RemoteCommand("LookupService", "RetrieveTypeCode");
lookupService.SetParameter("entityName", entityName);
var result = lookupService.Execute();
if (result.Success && typeof result.ReturnValue == "number") {
alert(result.ReturnValue);
return result.ReturnValue;
}
else {
return null;
}
}
You may not find the "RemoteCommand" in the SDK, But, internally this has been in use in CRM 2011. More information to fallow...
3 comments:
If you decide to not hate yourself you can just use crmForm.ObjectTypeCode and save the waste of a call.
The GetObjectTypeCode(entityName) method mentioned above will not work in a HTML web resource because a HTML web resource is always contained within an IFrame & calling the CRM methods becomes a challenge.
I am totally with the second comment, but, the alternative approach in that case would be using Metadate service.
Post a Comment