Views:

Scenario Overview

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

Formula

ForEachRecord(

  FindRecords('salesorderdetail', 'salesorderid',[salesorder.salesorderid],'*'), 

  UpdateRecord('product',
               CurrentRecord('productid'),
               SetAttribute('quantityonhand',
                           FindValue('product', 'productid',CurrentRecord('productid'),'quantityonhand') - CurrentRecord('quantity') ))
)

Wizard - FindRecords

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