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,
- A 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 Action' on the Order entity
- Set the Source Properties to 'Tax'
- Copy and paste the formula below into the formula canvas
- Save and test!
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