Scenario Overview

In this business scenario you have a Quote with a large number of Quote Products/Line Items. You require that both the Quote and its Quote Products sync up the field Tax Rate so that when a Quote's Tax Rate is changed, the Quote Products Tax Rate changes as well. 

Performing an update on a 1000+ records could go over Dynamics 365 two minute execution limit and thus we will use North52 to circumvent this. 

Note: The field Tax Rate is custom but this formula will work for any field you may need to update. 

N52 Formula Manager Solution

The Formula Manager solution works like this:

  • Each time a Quote's Tax Rate is changed, a workflow will trigger
  • This workflow will start a North52 formula 10 times
  • Each time the North52 formula will update the Quote Products Tax Rate field in batches of 100

N52 Formula Manager Steps

Create Formula

  • Create a new formula, setting the following values in the Formula Guide
    • Source Entity set to Quote
    • Set Formula Type to Process Genie
    • Select the Classic editor
  • Change the Name of the formula to Update Tax Rate of Line Items
  • Copy and paste into the editor this formula:
      SetVar('minRecordCount',  CalcMinRecordCount( GetSharedVariable('pageNumber', 1), 100)   ),
      SetVar('maxRecordCount',  CalcMaxRecordCount( GetSharedVariable('pageNumber', 1), 100)   ),
      /* Increments the page number Shared Variable each time the Process Genie STep executes in the workflow */
      SetSharedVariable('pageNumber', GetSharedVariable('pageNumber', 1) + 1), 
      ForEachRecord (
        Iftrue(RecordIndex() >=  GetVar('minRecordCount') && RecordIndex() <=  GetVar('maxRecordCount'),
             UpdateRecord('quotedetail', CurrentRecord('quotedetailid'),  SetAttribute('new_taxrate', [quote.new_taxrate]) ))
  • Click Save
  • Your formula should look like this:

Create the Workflow

  • Go to Settings > Processes 
  • Click on the New button and give it the name Quote Tax Rate Change
  • Set the Category to Workflow
  • Set the Entity to Quote
  • Check As an on-demand
  • Check Records fields change and then click the View link
    • Check 'Tax Rate' in the pop up
    • Click OK
  • Select Add Step > North52 > N52 Process Genie
  • Click Set Properties
    • For Formula Shortcode, enter the shortcode from the formula created above
    • Click OK
  • Repeat adding the same Process Genie step 9 more times
  • Click Save
  • Activate the workflow

Wizard - FindRecords

Please see below the wizard you can use to create the FindRecords() function call used in this formula.

Note: For the Equals Value, you will need to go to the Source tab and select the Quote field