Search code examples
dynamics-crmcrmdynamics-crm-online

Why business rules doesn't work but javascript works to make a field read only in Dynamics-365?


I was trying to make field Default Price List of Product entity to read only. I tried to do that from field properties by checking read only but it didn't work. Then I wrote a Business rule which will make the field read only that also didn't work.

Then I wrote a JavaScript code and attached that code in onLoad event of Product entity and it eventually worked.

Xrm.Page.getControl(attrLogicalName).setDisabled(true);

Actually I am trying to figuring out why business rules and field properties changes didn't work. Any idea?


Solution

  • This is expected behavior as the Product entity has some OOB scripts locking/unlocking the fields with an onChange logic.

    Probably Microsoft don't want you to interfere with that OOB implementation by using Business rule. As you said, custom javascript is the only possible approach.

    enter image description here