You need to sign in to do that
Don't have an account?

bypass trigger
I have a class which automatically creates portal user. I also have a trigger on user which has a callout on any updates on user. I need to bypass this user trigger whenever the user is created through this automated process and trigger should happen normally whenever a user edit happens other than auto creation process. how can i achieve this? Static variable a good option?
Yes I think the best way to go its with an static variable. I would say maybe an static MAP or a SET so you can decide whether an user need to be bypasses.
Something like:
Then in the class just save the user to be bypassed, since you are creating a user I recomend to use UserId not ID.
In the trigger, just ask before running the logic:
Please let me know how it goes
Regards,
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
Yes I think the best way to go its with an static variable. I would say maybe an static MAP or a SET so you can decide whether an user need to be bypasses.
Something like:
Then in the class just save the user to be bypassed, since you are creating a user I recomend to use UserId not ID.
In the trigger, just ask before running the logic:
Please let me know how it goes
Regards,
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.