Pages

Tuesday, 27 March 2018

How to get value from different types of data fields in Dynamic CRM using JavaScript.

String type
//Get value from string field
Xrm.Page.data.entity.attributes.get("name").getValue();



 Lookup type
//Guid of lookup record
Xrm.Page.data.entity.attributes.get("AccountId").getValue()[0].id;


//Name of Lookup record
Xrm.Page.data.entity.attributes.get("AccountId").getValue()[0].name;




Option Set Type
//get value from option set
Xrm.Page.data.entity.attributes.get("industrycode").getValue();

//Get text from option set
Xrm.Page.data.entity.attributes.get("industrycode").getText();

No comments:

Post a Comment

Get or Update fields on form using JavaScript in Dynamics 365 v9

After Microsoft released v9.0 of Microsoft Dynamics 365, Xrm.page became deprecated that it have been replaced by ExecutionContext.getFor...