CRM 2011 – Using Javascript to identifying if a form is in Create or Update Contect

Posted on April 17, 2011

4


Here is a quick tip to tell if a form is being created or updated in Javascript, this can be very useful for form load events and creating code which needs to be run when a form is being created, like setting the values of variables when a form is created.

var  formType= Xrm.Page.ui.getFormType();
getFormType() function returns a number
If the return value is 1 –  Form context is Create
If the return value is 2 –  Form context is Update
About these ads