How to restrict users to update closed Opportunity?

How to restrict users to update closed Opportunity?

Sample Trigger:

trigger OpportunityTrigger on Opportunity (before update) {
    for(Opportunity oppty : trigger.new) {
        if(trigger.oldMap.get(oppty.Id).StageName == ‘Closed Won’) {
            oppty.addError(‘Closed Opportunity cannot be updated’);
        }
    }
}

Cheers!!!

Leave a Reply