1

I recently experienced odd behavior where a trigger depending on the the Opportunity.amount field was not picking up the correct values from the amount field even though the context was after update. This leads me to believe that the standard amount rollup from OpportunityLineItem occurs after the OpportunityLineItem trigger has completed.

can anyone confirm that this is the case with documentation or otherwise?

2
  • The oppo.amount RSF should occur after the OLI DML has finished. Is your Oppo trigger also updating children OLI? – cropredy Aug 19 '14 at 1:52
  • your statement confirms my question and actually makes sense as I think about it. I had an after insert/update trigger on the OpportunityLineItem and was querying the Opportunity.amount field. but the Opporuntunity.Amount wont calculate until after the OpportunityLineItem trigger is complete becuase you could modify the oli total price, changing the opportunity amount. The solution to the issue, is to manually sum the totalprice and not rely on the Opportunity.amount field – ebt Aug 19 '14 at 20:20
0

The oppo.amount RSF should occur after the OpportunityLineItem (OLI) DML has finished.

If there are triggers on the OLI and they refer to Opportunity.amount, then the Opportunity.amount won't have been updated yet if the OLI had its TotalPrice field changed (or the OLI was created or deleted).

If there are triggers on the Opportunity that do DML on the OLI, then those Opportunity triggers will have to requery the Opportunity before relying on the value of Opportunity.amount at any point after the OLI DML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.