09-23-2018, 12:38 PM
Turns out we were not understanding each other correctly here. When you want to create a workflow on Invoices that sums up all the Invoice amounts from all Invoices related to the SalesOrder this Invoice is related to (confusing, yes I know) you can't just use
. This will get ALL invoices in the entire system for you. What you need to do is get some unique reference to the salesorder. I would not advise you to just use the reference field, since that will check against all SalesOrders with that subject line meaning: every SalesOrder that has the same subject (this is a free text field so VERY dangerous in this context) will qualify.
If you need to know how to to this: use a two step process to get the salesorder no. on to the invoice record like described here (you don't need the third workflow task there). This will match the invoices to the salesorder based on the salesorder no, which is reliable.
Code:
aggregation('sum','Invoice','sum_nettotal')
If you need to know how to to this: use a two step process to get the salesorder no. on to the invoice record like described here (you don't need the third workflow task there). This will match the invoices to the salesorder based on the salesorder no, which is reliable.