I have a trigger on user object which runs on the creation of new users of a particular profile and also has a future method called for assigning user some id's So my doubt is if I insert the user's via batch jobs will it violate governor limits? Also, suggest a workaround if possible to streamline the process.

Note I have around 3000 users which need to be inserted.

  • I'm not really sure what exactly you are asking. If code is written properly, it shouldn't violate any governor limits. Batch jobs automatically do even better breaking up the size of the number of records being executed.
    – dphil
    Apr 14, 2017 at 15:53
  • Like @dphil said that's the entire point of batching records so that you stay under limits. If you make your batch 200 and it runs through the 3k in 200 chunks you're good to go, if not crank the batch down to 150 and try again. Apr 14, 2017 at 16:09

1 Answer 1


You can Use static variable to turn off Trigger during batch processing: remember that statics are class members, not object instances. If You need trigger logic You can implement Your triger to process Users bulk-way to not shoot the limit, or You can turn of trigger with static variable mentioned above and implement similiar logic in batch which has higher limits. If You need more explaination feel free to ask.

  • I need trigger to run as it assign some Id to new users using a web service callout.
    – Ishan
    Apr 14, 2017 at 17:32
  • I told You what i would do in Your situation bro, I will not write it for You :) of course if You have some question feel free to ask. Fast idea: You can leave Your trigger as it is just turn of it during batch processing (using static), and implement bulk logic in Your batch to realize trigger logic and to avoid hiting limits. OR the better idea would be extract logic from trigger and move to service :) Many options
    – patryk
    Apr 14, 2017 at 20:32

You must log in to answer this question.

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