You need to sign in to do that
Don't have an account?
gidiem
Access a trigger name within a running trigger
We are implementing a system to toggle triggers ON and OFF from the UI. A custom seeting is deciding wheter it is ON or OFF but I want the code to be dynamic so I can also streamline the implementation. This also would help down the road if a trigger changes name and the developer forgets to change the hardcoded statement.
I need to access the trigger name within the trigger using metadata - is this possible?
I need to access the trigger name within the trigger using metadata - is this possible?
Hi Gidiem,
Try this Link (https://salesforce.stackexchange.com/questions/65096/how-to-get-the-trigger-name-in-trigger-itself-using-apex), Here they artificially generated an exception and grabbed that String output which is then processed to get the Trigger Name.
I hope it answers your query. Please Mark this solution as Best Answer to mark this question as solved.
Best,
Nithesh
You can Query ApexTrigger directly
Thanks for the tip, I saw that solution previously this morning which seems like a hacky workaround to the problem - raising an exception should be done if there is an exception not to parse a string ang gather information to build dynamic code. Thanks regardless.
Rajamohan - That returns every Id, Name from the existing triggers. I only want the name from the trigger that is currently running at that point in time.