Views:

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:
      • In Entity Name select Contact
      • In Where Attribute select Company Name
      • In Equals Value select Account
      • In Select Attribute select Contact
      • In Default Value type 0 (zero)
      • Click Generate
    • 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:

Did you know?

You can easily schedule recurring processes or CRM record updates

Every business has recurring processes and tasks that need to be done on repeatable and scheduled basis. Microsoft Dynamics 365 users are often surprised to learn that it is difficult to achieve using standard functionality. The North52 Scheduler makes it easy to trigger workflows and/or advanced business logic for specific entity records on a scheduled basis. 

Key features include:    

  • Create Recurring Schedules within Dynamics CRM
  • Powerful Record Targeting - easily create queries to target a specific set of records
  • High Performance - can process 100,000+ records on a scheduled basis
  • Execute Workflow/Action or Update Entities
  • Native to Dynamics 365

Learn more about the Scheduler