Views:

Scenario Overview

In this scenario the business requirement that needed to be solved was related to tax on Order Products

The customer wanted a simple way to update the Tax on all the Order Products connected to an Order. To solve this we added a custom tax field to the Order form that will hold the tax rate percentage. When this is changed the formula will calculate the value of the tax in each Order Product and update it accordingly.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • Formula of type 'Save - Perform Action' is created on the Order entity
  • Event is set to 'Create & Update'
  • Source Property is set to Tax

N52 Formula Manager Steps

The following set of steps outline how to create this Formula

  • Create a formula of type 'Save - Perform Actionon the Order entity
  • Set the Source Properties to 'Tax'
  • Copy and paste the formula below into the formula canvas
  • Save and test!

The Order with no tax percentage set.

After the Tax is set to 12.5%

The 50 Bicycles with the 12.5% tax applied.

Formula 

if(containsdata([salesorder.new_tax]),

  ForEachRecord(

    FindRecords('salesorderdetail', 
                'salesorderid',
                [salesorder.salesorderid], 
                SetFindSelect('salesorderdetailid','baseamount'), 
               '50', true),

    UpdateRecord('salesorderdetail',
      CurrentRecord('salesorderdetailid'),
      SetAttribute('tax', (CurrentRecord('baseamount') * [salesorder.new_tax]) / 100)
    )
  ),
  'NoOp'
)

Wizard - FindValue

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

Note to find the value for Equals Value, you will need to go to the Source tab and search for "Order" , click on Order 

Did you know?

There are a number of different ways North52 business rules can be used in Dynamics 365

These include:

  • Via API from another application. This allows a customized application to separate its rules so that they can be maintained outside of custom code.
  • In processes that loop over a collection of records - on Schedule or in real-time.
  • As a step in a Workflow, Custom Action, Business Process Flow or a Power Automate Flow.
  • Making forms more interactive. Visibility, validation, real time data updating is all provided by the North52 rule engine.
  • Security functions to restrict or open access to records.
  • ...and many more!

Learn more about North52 Business Process Activities