Skip to content

Instantly share code, notes, and snippets.

@emoran
Created March 20, 2022 23:21
Show Gist options
  • Save emoran/5cc66a7b25dc9251686755998e7b85e0 to your computer and use it in GitHub Desktop.
Save emoran/5cc66a7b25dc9251686755998e7b85e0 to your computer and use it in GitHub Desktop.
trigger Handler basic for salesforce
public class SObject {
public static void run(){
switch on Trigger.operationType {
when BEFORE_INSERT {
//Perform Before Insert logic'
System.debug('BEFORE INSERT FIRED');'
} when BEFORE_UPDATE {
//perform Before Update logic
} when BEFORE_DELETE {
//perform Before Delete logic
} when AFTER_INSERT {
//perform After Insert logic
} when AFTER_UPDATE {
//Perform After Update logic
} when AFTER_DELETE {
//Perform After Delete logic
} when AFTER_UNDELETE {
//Perform After UnDelete logic
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment