Make Read Only Fields in d365 using JavaScript
In d365 we can get the Control Name of the Field and then by using setDisabled(true) or setDisabled(false) property we can lock the Fields or make then read only.
setDisabled(true) //show the Field
setDisabled(false) //hide the Field
Ex.
function ShowhideField(paramContext){
var formContext = paramContext.getFormContext();
var fieldnames = formContext.Attribute();
console.log(Controls) // It will show all the field names
var controlName = formContext.getControl(); // It will show all the control names
var getControl = formContext.getControl('control name').setDisabled(true); // It will lock the field
}
formContext.getAttribute(); // This method will return all the Field names available on form or page
Please Leave a comment if anything is required.
d365
dynamics365
mda365
mda365.blogspot.com
Thanks