Views:

In this article, we will attach a rule to the already existing Quick Ribbon button on the list view. The rule is the same as the form rule, and will disable the button on the ribbon if there are existing invoices with over $100,000 outstanding on that account. 

We will use the already created formula from the previous article here.

Step 1: Configure the N52 Formula


The below formula return false if the Potential Customer field on the Quote is empty or if it is filled and the Outstanding Invoices calculation returns a value over $100,000.  It will return true if the field is filled and the calculation returns less than $100,000.

Step 2: Add the Quick Ribbon rule to the Command using Ribbon Workbench.


Open the Workbench and connect to your instance of Dynamics 365.

We are again using the same solution with just the Quote entity from previous examples.

Enable Rule


On your existing Command click on the Add Enable Rule. 

 


Set the name of the rule to be something meaningful. In this example, we are using new.quote.N52.QuoteListViewRule.

 

There will be 4 steps in this rule, each of them will be CustomRules

The first three will be used to load N52 support files on for the rule and the fourth will be used to execute the formula.

  • $webresource:north52_/javascript/n52.rest
  • $webresource:north52_/javascript/n52.json2 
  • $webresource:north52_/javascript/n52.clientside

The function name should be set to isNaN 

 


The fourth Javascript Action will use $webresource:north52_quick_ribbon.js and the function should be set to N52QuickRibbon.EnableDisableRibbonButtonView.

 

This time we will pass in 4 parameters:

  • Crm Parameter: SelectedControlSelectedItemsIds 
  • Crm Parameter: SelectedEntityTypeName  
  • Crm Parameter: UserLcid   
  • String Parameter: shortcode of the formula


When we navigate back to the Command we can see the rule is there.

 

Publish the solution and the rule is now active.

Quote List View


When we select a quote that has less than $100,000 in invoices on it, the button is visible.


 


 

When the value of open invoices is greater than $100,000 then the Ribbon is disabled and vanishes.