+ Start a Discussion

Trigger Update on related list?

Hey all,


Just a simple question:  Are triggers executed when lookup fields change from an outside source?


I have a Custom Object that references a Contact as a Lookup.  If I change that contact (thus changing the lookup) will that cause an update trigger to fire on that Custom Object?  Or, since the Lookup is a reference to the Contact, and the reference does not change (only the value that is being referenced does) would it not fire?

Imran MohammedImran Mohammed

Yes, updating a Lookup field too fires the trigger as the lookup field is defined on the object which has a trigger defined on it.  Even though it is lookup to a different object it doesn't mean that any change to it will prevent from Trigger getting fired.



Triggers are executed only when a database operation (insert, update…etc) occurs, not when lookup field changes. If you have written a trigger on update then Whenever you change the lookup and save the record a update trigger will be fired. It doesn’t matter that whether you have changed the value of any field or not. If you edit record and save it , an update trigger will be fired.


Thanks for your replies and my late getting back to you.


I don't think I made myself clear, or maybe I need reiteration.  It seems like you both are talking about an Update on the object that is changed, that is, if it's on a Contact, I change the Contact so that fires an update trigger on the Contact. 

What I'm really asking is:  If there is a lookup to a Contact from another outside source, and I change the Contact, will the trigger on the outside source fire? 


To make it less abstract:  I have a Custom Object Caller that has a lookup to a Contact in each of its records.  Let's say I go into the Contact page itself and change the name of a Contact that is referenced from Caller. This changes the lookup from the old name to a new name.  Will the Caller trigger fire even though I didn't actually modify it directly?  

Imran MohammedImran Mohammed

In this case the trigger will not fire. The caller object will always be referencing the record id of a particular lookup object and not the name of the record in the lookup object.