Skip to main content
i have a workflow for a custom inventory app.  when adding a new line item to an order, the workflow is to subtract the quantify of the number of items ordered from the inventory of the product.  the logic reads as follows:

 

IF(

 

ISNEW(),

 

Merchandise_r.total_inv_c - ordered_c,

 

Merchandise_r.total_inv_c - (ordered_c - |

 

PRIORVALUE(ordered_c))

 

)

 

i get that the logic is retreiving the previous value of the total inventory amount, and that it will subtract the number ordered from the total iventory value.  i'm hung up on the what appears to be a 'concat' pipe "|" in the formula.

 

can someone explain this logic to me?  thanks.
2 answers
  1. Nov 21, 2016, 10:13 PM
    actually yes.  i spoke with a developer who suggested the following to me. 

     

    it was written for efficiency purposes and maybe governance limit purposes.  it means NOT. so its basically saying dont perform the formula unless the prior values does NOT equal the new value.  so in this example, the user is entering multiple line items on an order form.   the line item objects are not saved in sfdc until the submit button is hit.  however, the workflow is being executed every time a new line item is entered.  rather than continuously recalcing the total inventory field for every line item already entered, only calculate the total inventory field for line items whose previous values dont match the new values.   make sense?  it basically does to me but i would have never taken that into consideration when writing this.   i guess its a good thing a developer wrote it instead of me.  :)