18

I recently discovered that updating your Chatter profile image won't cause the User trigger to fire (for fields SmallPhotoUrl or FullPhotoUrl). I was wondering what other fields, when updated, won't cause the sObject to which it is attached to fire any relevant triggers?

EDIT: On closer inspection the URLs themselves don't change at all when the image is changed, so I guess you wouldn't really expect the trigger to fire in that case. I'm going to edit the question to better reflect what is happening.

  • 2
    I'm starting to realize this question may really be better off as community wiki as there are probably a lot of possible answers. – Ryan Elkins Sep 30 '12 at 0:49
20

It's worth taking a look at Triggers and Order of Execution. It lists out step-by-step what happens when a trigger executes. Specifically, the steps on what happens when workflows fire and the steps on rollup summaries and relations to parents/grandparents is interesting.

If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.

So, updating the child inputs to a roll-up summary field can cause a trigger on an object to fire.

Also, checkout Salesforce - Operations that Don't Invoke Triggers.

Update -- Added example with explanation.

Consider the following example with a Master detail between Child and Parent and the following:

  • Number field on Child called Num Field
  • Roll-up summary on Parent that sums Num Field

Write the following trigger on Parent__c:

trigger ParentTrigger on Parent__c (before update) {
    for (Parent__c p : Trigger.New) {
        p.addError('Not going to save');
    }
}

Now go into the new or edit page for your Child object and fill in a value for Num Field and save the record and see what happens. You get:

Error: Invalid Data.

Review all error messages below to correct your data.

Not going to save

Next, blank out the Num Field and save and see what happens. No error is generated and the Child saves.

So when the child record is saved and the field feeds into the roll-up summary the parent trigger is executed.

  • Changing child records that feed into a rollup summary field can fire a trigger on the master? That surely doesn't sound right ? – techtrekker Sep 29 '12 at 22:23
  • @techtrekker - Yeah. That's why I posted this. Most people don't realize that. – Peter Knolle Sep 29 '12 at 23:12
  • Wow that is really cool. Cheers! – techtrekker Sep 30 '12 at 1:25
5

Any child records that are reparented as a result of the merge operation do not fire triggers. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_merge_statements.htm

4

A change in the value of a Formula field won't cause the sObjects update triggers to fire.

I did find the idea Fire Trigger on Formula Field value updates.

  • I don't know if I'd want that by default...some of the data models can get pretty complex with lots of formulas used for convenience. – Peter Knolle Sep 29 '12 at 20:28
  • @PeterKnolle I agree, while it is an Idea, I'm not sure it is a good idea. – Daniel Ballinger Sep 29 '12 at 21:29
4

With Territory Management enabled, changing the all-mighty Opportunity field TerritoryId doesn't fire Opportunity triggers.

0

In addition to those already mentioned: sorting the order of Quote or Opportunity Line Items will not cause either the parent or child objects to trigger. I can't find any documentation of this from Salesforce but it should be easy to verify by adding a trigger and then sorting line items.

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.