Change field requirement level with JavaScript – Dynamics CRM

To dynamically change the requirement level of a field, use the code below: //  Not required Xrm.Page.getAttribute("FieldName").setRequiredLevel("none"); // Business recommended Xrm.Page.getAttribute("FieldName").setRequiredLevel("recommended"); // Required Xrm.Page.getAttribute("FieldName").setRequiredLevel("required");

Advertisements

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