Overview
In this business scenario, the customer's business requirement was that they have a ribbon button that 'validates' an account. However the Validation ribbon button should only be shown if the account has at least 3 contacts connected to it, and they want it to respond the changes the user makes in the Contacts SubGrid in the form.
North52 Decision Suite
The North52 Decision Suite solution works like this:
- A Formula is set up that triggers on the refresh of the Contacts SubGrid
- This formula will refresh the ribbon by using the RibbonRefresh() function
- A second Formula will be added to the Ribbon button that will determine if the button should be shown or hidden
- This formula will return true or false based on the count of Contacts on the Account
Formula on SubGrid
- Create a new formula, setting the following values in the Formula Guide:
- Set Entity to Account
- Set Formula Type to ClientSide - Perform Action
- Set Editor to Classic
- Click Create
- Change the Name of the formula to Refresh Ribbon after refresh of Contacts Grid
- Expand Source & Target
- Under Source Property, select Contacts (SubGrid) on the Account form
- Click onto the Formula Canvas
- Select the Functions tab on the left-hand side and search for refresh
- Click on the RefreshRibbon() function at add it the canvas.
- Click Save
Enable Ribbon Button rule
To see detailed instructions about how to add enable rules to a Ribbon button please see this article. In this article we will only be looking at the formula that is being utilized for the enable rule:
- Create a new formula, setting the following values in the Formula Guide:
- Set Entity to Account
- Set Formula Type to ClientSide - Calculation
- Set Editor to Classic
- Click Create
- Change the Name of the formula to Account - Show Validate Button
- Click onto the Formula Canvas
- Select the Functions tab on the left-hand side and search for findcount
- Hold down the SHIFT key and click on the FindCount function to show the function wizard:
- This will add the completed FindCount function to the formula canvas
- Before the FindCount function, we will wrap this in an If function. If the Findcount result is >= 3, the result will be true, or else it will be false
- Click Save
Testing
To test these formulas, simply create an Account with 2 contacts, the button will not be visible on the form:
When a third contact is added the Validate Account button is now shown: