I'm an administrator not very familiar with code; I have been trying to deactivate a legacy apex trigger that predates me joining my company but it is causing some system issues. An option brought to my attention is to comment out the code and then push. I'm attempting to do this but am receiving the following error:

Compile Error: Unexpected token ''. at line 29 column 1

Does anyone have any insights? Here's my code below :

/* trigger AccountTrigger on Account (
    before insert, 
    before update, 
    before delete, 
    after insert, 
    after update, 
    after delete, 
    after undelete) {
    AccountTriggerHandler handler = new AccountTriggerHandler();
        if (Trigger.isBefore) {
            //call your handler.before method
                handler.isBeforeUpdate(Trigger.newMap, Trigger.oldMap);
        } else if (Trigger.isAfter) {
            //call handler.after method
            else if(Trigger.isUpdate)
                handler.isAfterUpdate(Trigger.newMap, Trigger.oldMap);
} */


1 Answer 1


You can't comment out the whole file and leave it empty, you'd comment out the body and leave the class header

trigger AccountTrigger on Account (before Insert){
       whatever code exists

However, there's an option to deactivate the trigger instead of updating the contents of the trigger. There's an Is Active checkbox just above the code editor when editing a trigger in the org. Afterwards, you can deploy that trigger into production to deactivate it (and eventually delete it).

enter image description here

  • 1
    Just to put some more emphasis on it, both commenting out a trigger and un-checking the "isActive" checbox is something that can only be done in sandboxes and scratch orgs. You will need to perform a deployment to affect this change in a production environment.
    – Derek F
    Mar 1, 2022 at 16:40

You must log in to answer this question.

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