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
NinoJoseNinoJose 

How Triggers are being handled by Salesforce??

HI All,

Im am wondering, how does salesforce handle triggers?

Im definitely sure that when a mass update occurs and a trigger on the object exist then it will handle bulk update on the trigger so trigger.new may vary depending on the number of records updated using the mass update.

However, for example two users updates the same record at the same time... how does salesforce handle it on a trigger? will there going to be to trigger context for each user? or will there be only one trigger?

Thanks
Jim_morrisonJim_morrison

Each user update will execute the trigger even if same record and same time. (although internally I believe they woud do syncronize thier code). 

With the newer versions, I believe, all Triggers are batch triggers by default.

 

 

 

NinoJoseNinoJose
Hi Jim,

thanks for the reply.

Just another question. How about when 2 or more users update/insert/delete a record. will they used the same trigger context? Or does salesforce have a time computation/time limit on how it will batch the records being edited/inserted/deleted?
Ron HessRon Hess
Two updates will run triggers with separate contexts, not shared.

There are governor limits on triggers (memory, statements,etc), these are documented in the developers guide.