Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. public with sharing class RecipeTriggerHandler {
  2.  
  3. //store data to update in list
  4. // -----------Trigger Handler Class Variables -----------------------------------------------
  5. List<Recipe__c> newRecipes;
  6.  
  7.  
  8. public static void handleBeforeUpdateInsert(List<Recipe__c> newRecipes){
  9.  
  10. for (Recipe__c recipe : this.newRecipes) {
  11. //duration logic - if less than 30 minutes, Quick
  12. if (recipe.active_time__c <= 30 && recipe.Active_Time_Units__c == 'Minutes') {
  13. recipe.duration__c = 'Quick';
  14. //duration logic - if 30-60 min, Medium - && evaluated before ||, so order should be good here?
  15. } else if ((recipe.active_time__c > 30 && recipe.active_time__c <=60 && recipe.Active_Time_Units__c == 'Minutes')
  16. || (recipe.active_time__c = 1 && recipe.Active_Time_Units__c =='Hours')) {
  17. recipe.duration__c = 'Medium';
  18. //duration logic - if more than 1 hr, Long
  19. } else {
  20. recipe.duration__c = 'Long';
  21. }
  22. } }
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement