In this scenario when an order is marked as 'Fulfilled' we need to loop over each of the Order Line Items & decrement the 'Quantity On Hand' field on the product entity with the quantity on the Order line Item.
N52 Formula Manager Solution
The Formula Manager solution works like this,
- We create a formula of type Process Genie so that it can be called from a workflow
- A workflow is created that checks when the order goes to a status of Fulfilled
- If it does go to Fulfilled then call the formula to loop over the order line items & decrement the quantity on hand from the product
N52 Formula Manager Steps
The following set of steps will set this formula up for you,
- Create a new formula of type 'Process Genie'
- Set the Source Entity to 'Order'
- Copy & paste the formula below into the formula description field
- Click Save
- Make a note of the formula short code in the top right hand corner of the formula. In this case 'ThY'
The following set of steps will set the workflow up for you,
- Create a new workflow based on the screenshot above
- Add a condition to check if the Order is Fulfilled
- If the condition is true then add the custom workflow activity named 'North52 Process Genie'
- Set the formula short code to ThY
- You are ready now to test
ForEachRecord( FindRecords('salesorderdetail', 'salesorderid',[salesorder.salesorderid],'*'), UpdateRecord('product', CurrentRecord('productid'), SetAttribute('quantityonhand', FindValue('product', 'productid',CurrentRecord('productid'),'quantityonhand') - CurrentRecord('quantity') )) )
Wizard - FindRecords
Did you know?
North52's Data Packager helps move configuration data between instances
North52 Data Packager is an add-on for North52 Business Process Activities which enables you to easily move data from one instance to another. Users simply select the records they would like to package up and North52 Data Packager adds the data to a data package sheet, ready for export. Moving the records to another instance requires the package solution to be imported and ‘unpacked’ on the target instance.
North52 Data Packager is ideal for:
- Moving Dynamics configuration records
- Copying Dynamics Portal records
- Distributing demonstration data