1

I just noticed that creating an OpportuniyLineItem fires my Opportunity trigger. I think that when the OpportunityLineItem gets created SF updates the HasOpportunityLineItem field on Opportunity which kicks in the Opportunity trigger.

  • Can somebody confirm if that's correct as I couldn't find anything on Google?
  • If that's the case is there a way to prevent the opportunity's trigger to fire?
2
  • The easiest way to see what is getting updated on the opportunity is by navigating through "Show Dependencies" button on the trigger. When you click on the button it shows all dependent object / the field that is getting updated on the object. If you see oppty in the list of objects then that's where you start debugging on which field is update on oppty , else keep looking in the dependent classes to see if there is update on oppty. Without looking at your trigger, its hard to say if it is just the HasOpportunityLineItem thats causing the oppty update
    – Rao
    Commented Jul 17, 2017 at 23:28
  • @Rao - thanks for that! There's no OpportuniyLineItem trigger in my org. All I do is I populate OpportunityId, PricebookEntryId, Quantity and UnitPrice on OppLineItem and then I insert it. The Opportunity trigger fires after. I don't see any dependency listed under the Opportunity trigger related to the OppLineItem.
    – Arthlete
    Commented Jul 17, 2017 at 23:52

1 Answer 1

7

The OLI fires the Opportunity trigger mainly due to Roll Up summary fields as well as other potential fields SF updates, including the standard Amount field. An update to OLI will always cause Opp triggers to fire and always has AFAIK

1
  • 3
    Including the standard Amount field
    – sfdcfox
    Commented Jul 18, 2017 at 1:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .