Think Dynamic, Do Dynamic Microsoft Dynamic CE | Powerapps || Dynamic CRM || Power Apps || Power Platform

Wednesday, 31 August 2022

How to lock fields Using javascript Dynamic CRM 365

How to lock field using javascript Dynamic CRM 365 | How to read-only fields using custom Javascript


function onRecordSelect(exeContext) {

var _formContext = exeContext.getFormContext();

//add fields schema name you want to disable fields

var disableFields = ["vwi_name","vwi_paymentcode","vwi_claimid","vwi_totalpaymentamount"];

lockFields(exeContext, disableFields);

}

//Function

function lockFields(exeContext, disableFields) {

var _formContext = exeContext.getFormContext();

var currentEntity = _formContext.data.entity;

currentEntity.attributes.forEach(function (attribute, i) {

if (disableFields.indexOf(attribute.getName()) > -1) {

var attributeToDisable = attribute.controls.get(0);

attributeToDisable.setDisabled(true);

}

});

}


No comments:

Post a Comment

Popular Posts

Featured post

Understanding Dataverse MCP vs Power Apps MCP – Quick Review

  Understanding Dataverse MCP vs Power Apps MCP – Quick Review Model Context Protocol (MCP) has quickly become one of the hottest topics in ...

Post Top Ad

Your Ad Spot

Pages

SoraTemplates

Best Free and Premium Blogger Templates Provider.

Buy This Template