How To : Set A Fields On A Form Required Or Recommended Using Java Script in CRM

// Required

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("required");

//Recommended

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("recommended");

// None

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("none");