SHARE
TWEET

Untitled

a guest Mar 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top