function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TSH53TSH53 

Trigger not being called - Mass Update Addresses

I have a trigger for the Contact object (before insert, before update) that works perfectly in all situations I have tested so far - except for one. When I attempt to use the 'Mass Update Addresses' feature to update a country or state/province field, my trigger is not called. The wizard nicely informs me that it is going to update the appropriate field on the Contact record, but then never calls my Contact trigger.

 

Is this because somewhere behind the scenes it is updating the address information in another physical location (say an internal address table) instead of fields directly on the contact object itself? This is the only rationale I can think of for this behavior.

 

Can anyone shed some light on the situation for me?

 

This is pretty problematic for me since the trigger needs to do some important stuff whenever the value in the state/province or country field changes.

 

Thanks in advance for any assistance you can provide.

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae

Have you tested any other bulk scenarios? That is where multiple records are updated together?

My guess would be that the trigger is not bulk ready, and so, only updates the first record in the set being updated.

Could you post your trigger code?  It should include some type of loop on the Trigger.new object array in order to process all records.

All Answers

JimRaeJimRae

Have you tested any other bulk scenarios? That is where multiple records are updated together?

My guess would be that the trigger is not bulk ready, and so, only updates the first record in the set being updated.

Could you post your trigger code?  It should include some type of loop on the Trigger.new object array in order to process all records.

This was selected as the best answer
TSH53TSH53
Thanks for the reply. Yes - I have tested other bulk scenarios and my code is very bulk ready. I even put a system.debug statement as the first line of code just to see if anything was getting called. (Plus I have several other system.debug statements throughout the code at the moment - all of which get called in my other test cases, but never during Mass Update Addresses)