Skip to content

Instantly share code, notes, and snippets.

@melissajhansen
Created March 27, 2021 19:02
Show Gist options
  • Save melissajhansen/5892ffa7c8a8ef40b8380824da70200a to your computer and use it in GitHub Desktop.
Save melissajhansen/5892ffa7c8a8ef40b8380824da70200a to your computer and use it in GitHub Desktop.
A simple, static Trigger Handler for the Recipe Trigger
public with sharing class RecipeUtil {
public static void handleBeforeInsert(List < Recipe__c > newRecipes) {
for (Recipe__c rec : newRecipes) {
if (rec.Name==null || rec.Active_Time__c==null || rec.Description__c==null || rec.Active_Time_Units__c==null || rec.Servings__c==null) {
rec.Draft__c = true;
}
}
}
public static void handleAfterInsert(List < Recipe__c > newRecipes) {
}
public static void handleBeforeUpdate(List < Recipe__c > updatedRecipes, Map < Id, Recipe__c > oldRecMap) {
}
public static void handleAfterUpdate(List < Recipe__c > updatedRecipes, Map < Id, Recipe__c > oldRecMap) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment