• Mila Johnson
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hello all,

Need some help on this trigger please. Created a custom setting to bypass user for this trigger.

trigger Deleteaccount on Account (before delete) {
    
        Automation_Processes__c Automation = Automation_Processes__c.getInstance(UserInfo.getUserId());
        
        
    if(!Automation.Bypass_Account_Deletion_trigger__c){
       return;
        }
        
    System.debug(' accountdeleteTrigger');
    for(Account acc : trigger.old){
            acc.adderror('Account Cannot be deleted');
    }

    
}
We have a before delete trigger on the account to prevent account deletion for all. So how can we make an exception for just one or two users?


trigger preventAccountDeletion on Account (before delete) {

    for(Account acc : trigger.old){
       
        acc.adderror('Account Cannot be deleted');
    }

}
We have a before delete trigger on the account to prevent account deletion for all. So how can we make an exception for just one or two users?


trigger preventAccountDeletion on Account (before delete) {

    for(Account acc : trigger.old){
       
        acc.adderror('Account Cannot be deleted');
    }

}
Hi ,

I have written below validation rule to prevent submitting a record.
Status is a picklist field.

AND(ISPICKVAL(Status_vod__c, 'Submitted_vod'))

When user clicks submit button the above rule should fire and display error message.

But this is not happening. Validation error is not getting displayed and the record is also not getting submitted.

Can you please help me on this

Thanks
Hi, 

  How to by pass trigger for a specific users in salesforce. 

Thanks
Sudhir
  • December 07, 2018
  • Like
  • 0