Hi Guys,
I have a requirement that I need to deactivate a trigger without modifying it in production. Is there any magic wand to do this. Kidding, isn't. it :P
Obviously this is not my Idea , a friend of my told me how to do this so thought to share with all of you.
Solution:-
Have your ever heard of custom setting. yes, In custom setting you need to make a check box field. name it switch.
Then in your trigger you need to querry the this custom setting field and just check whether it is true or false. If it is true then run your logic otherwise do nothing.
Lemme share the code snippet with you.
So , when ever you want to deactivate the trigger in production just go to custom setting and uncheck the check box.
keep learning Salesforce
thanks
ankushsalesforce@gmail.com
I have a requirement that I need to deactivate a trigger without modifying it in production. Is there any magic wand to do this. Kidding, isn't. it :P
Obviously this is not my Idea , a friend of my told me how to do this so thought to share with all of you.
Solution:-
Have your ever heard of custom setting. yes, In custom setting you need to make a check box field. name it switch.
Then in your trigger you need to querry the this custom setting field and just check whether it is true or false. If it is true then run your logic otherwise do nothing.
Lemme share the code snippet with you.
Trigger SwitchTrigger on Account (<event>){
if(Switch__c == true){
Your *** Logic
}
}
So , when ever you want to deactivate the trigger in production just go to custom setting and uncheck the check box.
keep learning Salesforce
thanks
ankushsalesforce@gmail.com
No comments:
Post a Comment