Hi, I have a rather complicated situation which I will try and simplify. Consider an opportunity, that has the following fields, all currencies:
So here is the issue, it seems that orderTotalConverted is only assigned a value once the script has completed, and has the value of 0 otherwise (or probably the previous value, I have not tested).
Right now I have to trigger several record writes to get the formula to run several times, each time the value works down the chain.
Is there any way the value of the "Converted" variable could be evaluated after ever line?
Or is there a better way of doing this? Would linked workflows solve the problem?
For reference the full formula currently looks like this:
- amount - what I sell for, one of EUR, GBP or USD
- support - what I sell for, one of EUR, GBP or USD. ALWAYS the same currency as amount
- orderTotal - a calculated currency field that is amount + support
- buyPrice - what I buy for (the total), one of EUR, GBP or USD, but not always the same as Amount
- margin - always in GBP (system base currency), and the "amount" in GBP less the "buyPrice" in GBP.
Code:
orderTotal = amount + support; orderTotalCurrency = amountCurrency; margin = orderTotalConverted - buyPriceConverted; marginCurrency = 'GBP';
So here is the issue, it seems that orderTotalConverted is only assigned a value once the script has completed, and has the value of 0 otherwise (or probably the previous value, I have not tested).
Right now I have to trigger several record writes to get the formula to run several times, each time the value works down the chain.
Is there any way the value of the "Converted" variable could be evaluated after ever line?
Or is there a better way of doing this? Would linked workflows solve the problem?
For reference the full formula currently looks like this:
Code:
$tempMonth = datetime\month(closeDate); $qtr = ($tempMonth - 1)/3; $strQtr = string\substring($qtr, 0, 1); $numQtr = $strQtr + 1; closeQuarter = string\concatenate(datetime\year(closeDate),"Q",$numQtr); s4OrderTotal = amount + support + services + subscription; s4OrderTotalCurrency = amountCurrency; margin = s4OrderTotalConverted - buyPriceConverted; marginCurrency = 'GBP'; ifThenElse(forecastStatus=='Pipeline', s4WeightedMargin=0); ifThenElse(forecastStatus=='Possible', s4WeightedMargin=(marginConverted* 0.25)); ifThenElse(forecastStatus=='Probable', s4WeightedMargin=(marginConverted* 0.5)); ifThenElse(forecastStatus=='Commit', s4WeightedMargin=(marginConverted* 0.90)); ifThenElse(forecastStatus=='Closed', s4WeightedMargin=(marginConverted));
Comment