OptionSet fields and Javascript – Dynamics CRM

In order to get and set values in an OptionSet field in JavaScript, use the code below: // Get Option Set var Option_Set = Xrm.Page.data.entity.attributes.get("FieldName"); // Get Option Set / Selected Option var OptionSet_Selcted_Option = Xrm.Page.data.entity.attributes.get("FieldName").getValue(); // Get Option Set / Options var OptionSet_Options = Xrm.Page.data.entity.attributes.get("FieldName").getOptions(); // Get Option Set / Label text var OptionSet_Label_Text … Continue reading OptionSet fields and Javascript – Dynamics CRM

Lookups and Javascript – Dynamics CRM

// Get Lookup var LookupField = Xrm.Page.data.entity.attributes.get("FieldName"); // Get Lookup ID // NOTE: To avoid possible errors, verfy that the lookup has value with: //   If(LookupField != null) var LookupID = Xrm.Page.data.entity.attributes.get("FieldName").getValue()[0].id; // Get Lookup Value Name // To avoid possible errors, verfy that the lookup has value with: //   If(LookupField != null) var LookupName … Continue reading Lookups and Javascript – Dynamics CRM