Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. (HasOpportunityLineItem &&
  2. (ISCHANGED( Total_List_Price__c)) ||
  3. (ISCHANGED( Total_End_User_Price__c)) ||
  4. (ISCHANGED( Total_End_User_Price_Discount__c)) ||
  5. (ISCHANGED( Total_Standard_Price__c)) ||
  6. (ISCHANGED( Total_Standard_Price_Discount__c)) ||
  7. (ISCHANGED( Total_SPR_Price__c)) ||
  8. (ISCHANGED( Total_SPR_Price_Discount__c)) ||
  9. (ISCHANGED( Total_Price__c)) ||
  10. (ISCHANGED( Total_Price_Discount__c)) ||
  11. (ISCHANGED( Total_SPR_Margin__c)) ) && dummyCheckbox__c == True
  12.  
  13. trigger TotalOpportunityProductTrigger on OpportunityLineItem (after insert, after update, after delete) {
  14.  
  15. Opportunity Oppor = new Opportunity();
  16. LPGCalculatorSettings__c objCalSetting = LPGCalculatorSettings__c.getValues('RollupTriggerSwitch');
  17.  
  18. if(objCalSetting.value__c){
  19. TotalOpportunityProductTriggerHandler tp = new TotalOpportunityProductTriggerHandler();
  20.  
  21. if(Trigger.isInsert && Trigger.isAfter){
  22.  
  23. tp.TotalField(Trigger.new);
  24. oppor.dummyCheckbox__c = False;
  25. }
  26. else if (Trigger.isUpdate && Trigger.isAfter){
  27.  
  28. tp.TotalField(Trigger.new);
  29. oppor.dummyCheckbox__c = False;
  30. }
  31. else if(Trigger.isDelete && Trigger.isAfter){
  32.  
  33. tp.TotalField(Trigger.old);
  34. oppor.dummyCheckbox__c = False;
  35. }
  36. }
  37. }
  38.  
  39. if(Trigger.isInsert && Trigger.isAfter){
  40. //you need to set the checkbox field false here
  41. //but as this code run in After syntax so first you need to query all Opportunity and then set it to false.
  42. // and you need to do this in all if conditions.
  43. tp.TotalField(Trigger.new);
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement