The return value for Xrm.Page.data.entity.getId() will return NULL, when called from a Create form (specific to Dynamics CRM version 2011)
The return value for Xrm.Page.data.entity.getId() will return EMPTY STRING, when called from a Create form (specific to Dynamics CRM version 2013).
To handle this given situation in any version (2011,2013 or 2015), you could implement the following code:
var FormType = Xrm.Page.ui.getFormType();
if(FormType != 1) //Refers to update form or other Form statuses.
{
var myId = Xrm.Page.data.entity.getId();
}
Happy coding....
No comments:
Post a Comment