Dynamics CRM Javascript · Javascript · Low Code No Code

{Dynamics 365} Lock a field after saving a record

Wondering if we can disable a field after save. For example, when user creates a new record, it is editable, but after save, it not editable.

Low Code No Code solution

To achieve this requirement we can make use of Business Rule where we can check if CreatedOn field contains data and if true lock the field. CreatedOn field will not have data on Create of record.

lockfieldaftersave

Javascript code to achieve this requirement

var _formContext=executionContext.getFormContext();
var  formType= _formContext.ui.getFormType();

if(formType == 2){
_formContext.getControl("new_fieldname").setDisabled(true);
}

Hope this helps!

2 thoughts on “{Dynamics 365} Lock a field after saving a record

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s