Xrm.Page.ui contains different methods to retrieve information about the user interfaces and its sub components in the form. Within that scope we have a method using which we can achieve this requirement.
Xrm.Page.ui.getFormType()
This method indicates the form context for the record. Indication of the form type is through an integer value from which we can identify the state of the record. Below are the list of possible numbers which can be returned via this method.
- 0 - Undefined
- 1 - Create
- 2 - Update
- 3 - Read Only
- 4 - Disabled
- 5 - Quick Create (Deprecated but still the same is supported)
- 6 - Bulk Edit
- 11 - Read optimized
var formType = Xrm.Page.ui.getFormType();
switch (formType)
{
case 0: //Logic for undefined.
break;
case 1: //Logic for Create.
break;
case 2: //Logic for Update.
break;
case 3: //Logic for Read Only.
break;
case 4: //Logic for Disabled.
break;
case 5: //Logic for Quick Create.
break;
case 6: //Logic for Bulk Edit.
break;
case 11: //Logic for Read optimized.
break;
}
No comments:
Post a Comment