SHARE
TWEET

Untitled

tototototo123 Sep 20th, 2019 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trigger Transaction_AfterInsert on Transaction__c (after insert) {
  2.  
  3.     List<Transaction__c> listTransactions = new List<Transaction__c>();
  4.     Set<Id> setTransactionIds = new Set<Id>();
  5.    
  6.     for (Transaction__c transac : Trigger.New) {
  7.         if (transac.TYPECO__c == 'Order') {
  8.             Transaction__c newTransactions = new Transaction__c(Id = transac.Id);
  9.             setTransactionIds.add(transac.Id);
  10.         }
  11.     }
  12.    
  13.     if(!setTransactionIds.isEmpty()) {
  14.         listTransactions = [SELECT Id, TYPECO__c, ACCOUNT__c, CASEORIGIN__c FROM Transaction__c WHERE Id IN :setTransactionIds];
  15.     }
  16.    
  17.     //Reassign CASEORIGIN__c if Type = Order
  18.     if(PAD.canTrigger('TR001_Transaction') && !listTransactions.isEmpty()) {
  19.         TR001_Transaction.applyUpdateRules(listTransactions);
  20.     }
  21.    
  22. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top