Thursday, December 9, 2010

CRM 2011sample java script

Few sample scripts for crm 2011

// Getting the Form Type
Xrm.Page.ui.getFormType()

// Set Focus to a field
Xrm.Page.getControl("fieldname").setFocus(true);


// Setting required Field dynamically
Xrm.Page.getAttribute("fieldname").setRequiredLevel("none");
Xrm.Page.getAttribute("fieldname").setRequiredLevel("required");