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.

North52 Decision Suite Solution

The North52 Decision Suite 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

North52 Decision Suite 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?

North52 has a powerful distributed cache for advanced decision logic

xCache allows you to configure and scale your Dynamics 365/CRM applications running On-Premise or Online. It allows dynamic system configuration and removes performance bottlenecks related to data storage. xCache provides Dynamics 365/CRM with an extremely fast and scalable distributed cache to power your advanced decision logic.

xCache in Dynamics CRM  lets you cache static application data, and also load dynamic cache items for applications running in a single or multi-server configuration.

Learn more and see examples of xCache