Search This Blog

Showing posts with label Get. Show all posts
Showing posts with label Get. Show all posts

Friday, December 6, 2013

Get lookup value and also set into other field

var P_lookupValue = new Array();             
P_lookupValue[0] = new Object();
P_lookupValue[0].id = lookup.Id;
P_lookupValue[0].name = lookup.Name;
P_lookupValue[0].entityType = "lookup_name";
              
Xrm.Page.getAttribute("field_name").setValue(lookupValue); //set lookup value into field
Xrm.Page.data.entity.attributes.get("field_name").setSubmitMode("always"); // this line will set value if field is readonly

Get OptionSet Value

var optionSet = Xrm.Page.data.entity.attributes.get("optionsetname");
var optionSetValue = optionSet.getValue();