function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rick MacGuiganRick MacGuigan 

Cannot comment out Trigger

OK, I'm confused. I've deactivated this trigger and want to comment it out in the sandbox. Why am I getting:
Error: Compile Error: unexpected token: <EOF> at line 9 column 0
/*
trigger AuditTrigger on Audit__c (after insert, after update) {

//trigger deprecated by Process builder chatter feed .
    if (trigger.isAfter && (trigger.isInsert || trigger.isUpdate)) {
        ReportStatusChatterPost.postToChatter(trigger.newMap.keySet(), trigger.isInsert);
    }
}
*/
If I do this , no error. But I really don't want this.
 
trigger AuditTrigger on Audit__c (after insert, after update) {
/*
//trigger deprecated by Process builder chatter feed .
    if (trigger.isAfter && (trigger.isInsert || trigger.isUpdate)) {
        ReportStatusChatterPost.postToChatter(trigger.newMap.keySet(), trigger.isInsert);
    }
*/     
}


 
Best Answer chosen by Rick MacGuigan
James LoghryJames Loghry
The trigger definition is required, hence why you can't comment out the entire block of code.  Instead, your second option is the way to go, or better yet set the trigger to "inactive".

All Answers

logontokartiklogontokartik
You cannot really comment out the whole trigger, is doesnt really make sense for compiler as its looking for a trigger with that name and all it finds is empty block. The only way you can do this is either delete the trigger using destructiveChanges.xml or comment the body of the trigger as you did in the 2nd step.

What exactly are you trying to achieve commenting out as you did in 1st way?
James LoghryJames Loghry
The trigger definition is required, hence why you can't comment out the entire block of code.  Instead, your second option is the way to go, or better yet set the trigger to "inactive".
This was selected as the best answer
Rick MacGuiganRick MacGuigan
Thansk all for the response. Since we can't delete the triggers I want them to be deactivated and never run if acccidently activated somehow. The IDE here is too restricitive. 
damion medamion me