Set CRM 2011 field requirement level in runtime

CRM 2011:

// No Constraint
Xrm.Page.getAttribute("field_schema_name").setRequiredLevel("none");

// Business Required
Xrm.Page.getAttribute("field_schema_name").setRequiredLevel("required");

// Business Recommended
Xrm.Page.getAttribute("field_schema_name").setRequiredLevel("recommended");

CRM 4.0:

// No Constraint
crmForm.SetFieldReqLevel("field_schema_name", 0);

// Business Required
crmForm.SetFieldReqLevel("field_schema_name", 1);

// Business Recommended
crmForm.SetFieldReqLevel("field_schema_name", 2);

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *