Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public class CalculateShippingDate {
  2.  
  3. @InvocableMethod(Label='add two business days')
  4. public static void addTwoBusinessDaysToCase(List<Case> inputCase){
  5. Datetime plusTwoDays = BusinessDays.addGmt(System.today(), 2);
  6. List<Case> caseList = [SELECT Id, Shipping_Date__c
  7. FROM Case
  8. WHERE Id = :new Map<Id, Case>(inputCase).keySet()];
  9. Case currentCase = caseList.get(0);
  10. currentCase.Shipping_Date__c = plusTwoDays.Date();
  11. update currentCase;
  12.  
  13. System.debug('The case was updated with an shipping date date of: ' + currentCase.Shipping_Date__c);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement