A Little Background
A field (msdyn_customergroupid / Customer Group) exists in Dataverse for the Account table, but it is not showing on the Account form in a Dynamics 365 model-driven app. Our requirement was to show this on the form and I know that we had made it visible on the Account form.
However, after a deployment we noticed that it wasn't the case. Now it could be because on various reasons:
- The field is hidden on the form level.
- Column security profile was implemented.
- There is a business rule, due to which it was hidden.
- There is a script, due to which the field was hidden.
Our Approach
The easiest way to rule out the problem is to start with the simplest reason and work your way up.
Step 1 - To check if field was hidden on the form
We checked if the field was hidden on the form? It wasn't. That was easy.
Now, to check Business Rules and Script was a hard road for us because we had 20+ rules and many functions written on form load.
Step 2 - Run quick form-runtime checks (console logic)
We used simple client checks to classify the problem.
This is the fastest way to know whether you’re dealing with design-time vs runtime.
Click F12 > Console and run these commands:
Xrm.Page.getControl("msdyn_customergroupid")
If the call returns null, the field is not on the form. For us, tt returned the Control means something must be hiding it.
Xrm.Page.getControl("msdyn_customergroupid").getVisible()
If it returns a control, something must be hiding it. We ran the below command to confirm:
It returned FALSE.
Step 3 - Use PowerApps Live monitor to capture the visibility change
When I opened the PowerApps Live Monitor and performed the steps within the App, I captured a Live monitor event:
- dataSource: Forms.FormChecker.ControlStateChange
- controlName: msdyn_customergroupid
- visible before: true
- visible after: false
And the call stack included:
- M.setVisible(...)
- pbl_c3f86e4e73b7ed1183ff6045bd8c93df(...)
- Mscrm.BusinessRulesScript.Initialize(...)
Key Finding:
The field was initially visible, then explicitly hidden at runtime by a business rule script.
This pattern indicates the visibility change came from a Business Rule (Power Apps compiles business rules into runtime scripts, commonly visible as pbl_<guid> style functions).
So we could say with confidence:
✅ A Business Rule running on the Account form hid Customer Group by calling setVisible(false).
✅ Not JavaScript web resources. Not security. Not form XML missing. Not personalization.
✅ Focused our attention to look at all the business rules and we could find the culprit.
Hope this helps!

No comments:
Post a Comment