MS CRM - Using JavaScript to identify if a form is in Create or Update or other states.

var FORM_TYPE_CREATE = 1;

var FORM_TYPE_UPDATE = 2;

var FORM_TYPE_READ_ONLY = 3;

var FORM_TYPE_DISABLED = 4;

var FORM_TYPE_QUICK_CREATE = 5;

var FORM_TYPE_BULK_EDIT = 6;

var formType = Xrm.Page.ui.getFormType();
if (formType == FORM_TYPE_CREATE) {

}

else {

}

MS CRM - Get Option Set Value and Label using java script

Brief: Suppose that you have an option set on a Dynamics CRM 2011 Form and you would like

to get the value and & the label of the selected item.

  • To get label 

Xrm.Page.getAttribute("OptionSetSchemaName").getText();

  • To get value 

Xrm.Page.getAttribute("OptionSetSchemaName").getValue();