Locking fields on the Form by adding dependencies in Dynamics 365 CRM

As a best practice, you must ensure that other Customizers of your system don’t accidently remove the field from the Form which is dependent on your JavaScript code on the form.

Scenario

Let’s consider this scenario and securing this field from removal from form –

  1. You have a Budget Amount field on the Opportunity form which is used in your JavaScript and should not be removed. Or could be some other reason like Business Rule or plugins.

  2. This field can be easily removed by clicking on Remove because if you look at the Field Properties, this has not been locked yet.


    Let’s ensure no one is able to remove this field.

Lock Fields on the Form – Manual

First step is to manually locking this field on the form.

  1. If you open the Field Properties, you’ll see that you can actually select Lock the field on the form.

  2. This will work and ensure that the field is locked on the form. But, it is open for a new person to simply unlocking from Field Properties and removing the field later on.

  3. Hence, let’s look at a recommended way to secure these fields further.

Lock Fields on the Form – Creating Dependency

Here’s a recommended way to lock fields on the form in a better way –

  1. Assuming this field is still unlocked on the Form and you need to secure it.

  2. In Form Properties, go to Non-Event Dependencies tab.

  3. Now, select the field in question. Budget Amount in this case.
    Move it over to Dependent fields list from Available fields and click OK.

  4. Now, you can see that the field is locked on the form again.

  5. And if you try to unlock it from Field Properties, it won’t be unlocked from there since you have created a Dependency for the same.
    You can see that the option to unlock/unselect the Lock the field on this form is disabled.

  6. And to remove this, you actually need to go to Form Properties and remove it from the Non-Event Dependencies list which is a good measure instead of locking it from the Field Properties itself.

Hope this was useful!

Here are some Power Automate posts you want to check out –

  1. Blocking Attachment Extensions in Dynamics 365 CRM
  2. Upgrade Dataverse for Teams Environment to Dataverse Environment
  3. Showing Sandbox or Non Production Apps in Power App mobile app
  4. Create a Power Apps Per User Plan Trial | Dataverse environment
  5. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  6. Co-presence in Power Automate | Multiple users working on a Flow
  7. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  8. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  9. Call a Flow from Canvas Power App and get back response | Power Platform\
  10. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  11. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  12. Asynchronous HTTP Response from a Flow | Power Automate
  13. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  14. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!