In some business scenarios users should only add one (or two) child records. The quickest way to enforce this in Dynamics 365 is to hide the New button after the sub-grid reaches a specific row count. This article shows how to:
- Create a JavaScript enable rule that counts rows.
- Refresh only that sub-grid’s ribbon so the rule re-evaluates instantly—no full form reload.