Skip to main content

Notifications

Disable a Sub-grid in the Form

Overview

In many scenarios, we need to disable a sub-grid in the Dynamics 365 Form.

For example:

The Contact sub-gird in the Account Form.

We need to disable the Sub-grid when certain conditions are met:  the Account's status reason is Pending Approval ...

How to disable it?

After researching with my teammates and checking all sub-grid related JavaScript client APIs, we didn't find any OOB solutions on it.

Then we raised a Service Request to the Microsoft CSS (Customer Services and Support) Team, the result from them is the same, there is no out-of-box solution to do that.

Workaround

After further investigation, we found that we can achieve this requirement in the following two ways.

Manner 1:

We can add a custom Enable Rule to an OOB Ribbon. 

For more details, please refer to this link.  Add a custom Enable Rule to OOB Ribbon 

Manner2:

You did a limitation in the backend to avoid child record creation in the sub-grid while the main record was in a certain status.

Such as you can develop a sync plugin that is registered on child record creation. Then you can query the main record status in your custom plugin code. Once the condition is met, the code can throw an error message to stop the child record creation in this situation.

Even if we remove the “create” button from the sub-grid in the main record, we can still create a new child record that points to the main record in the child record creation page. It will result that a new child record being added to the main record sub-grid even though the “create” button was removed.

The End

Comments

*This post is locked for comments