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.
North52 Decision Suite Solution
The North52 Decision Suite 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
North52 Decision Suite 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 Quick Buttons can be used on Dynamics Portals Entity Forms
That's right, you can trigger complex business rules via a button on an Entity Form. You could:
- Retrieve information from another entity or even another system and return it to the form
- Create or Update records on the button click
- Process advanced decision logic from information that has been completed on the form but not submitted
- Have dynamic buttons showing different options dependent on your business rules
- And much more!
Learn more about North52 Quick Buttons for Dynamics Portals