salesforce - Updating OpportunityProducts using Opportunity Trigger -


i use calculation on opportunity products (i.e.line items) uses term of opp stored in opp (ex: oli.recurringamt = opp.term * oli.unitprice * oli.quantity)

if valdue of term (integer) in opp changes, math in each oli needs updated manually. i'm proposing use trigger on opp update time term changes.

here's question: since amount field in opp auto-calculated sfdc sum of unitprice of each related line item times quantity, every line item, run recursion problems updating oli records opp trigger will, default, try update amount field of same opp firing trigger?

if not cause issues, should trigger on "after update" or "before update"? , sfdc recalculate updated amount value before or after trigger completes?

thanks insight on this.

trigger recursion occur in case if changing opportunitylineitem (oli) unitprice or quantity.

the standard practice use static member or property within transaction detect if operation has been performed.

see how avoid recursive trigger. basic example. extend maintain set of opportunity ids have been processed.

i'd recommend using after update trigger.

incidentally, salesforce.stackexchange.com/ great place ask salesforce specific questions.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -