Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.35 KB | None | 0 0
  1. List<SBQQ__Quote__c> currentQuotes = [SELECT Id,
  2.                                       SBQQ__QuoteTemplateId__c,
  3.                                       RecordTypeId FROM SBQQ__Quote__c where
  4.                                       (sbqq__quotetemplateid__c = null OR SBQQ__QuoteTemplateId__c = '')
  5.                                       AND SBQQ__Status__c != 'In Draft'
  6.                       AND SBQQ__Status__c != 'Rejected'
  7.                         AND RecordTypeId != '012f3000000gzaXAAQ'
  8.                         AND RecordTypeId !=  '012f3000000gzaYAAQ'
  9.                                       AND RecordTypeId != null limit 100];
  10.  
  11. String AutomotiveQuote = '012f3000000gzaXAAQ';
  12. String AutomotiveQuoteReadOnly = '012f3000000gzaYAAQ';
  13.  
  14. String HEREPartnerQuote = '012f3000000YbcGAAS';
  15. String HerePartnerQuoteReadOnly = '012f3000000Ybg1AAC';
  16. String HerePartnerQuoteReadOnlyv2 = '012f3000000YbcHAAS';
  17.  
  18. String PriceLetter = '012f3000000gzZFAAY';
  19. String PriceLetterReadOnly = '012f3000000gzZLAAY';
  20.  
  21. String Quote = '012f3000000gzZGAAY';
  22. String QuoteReadOnly = '012f3000000gzZMAAY';
  23.  
  24. String priceLetterTemplate = 'a1Qf3000006R82AEAS';
  25. String simplifiedTemplate = 'a1Qf3000006R82BEAS';
  26. String partnerTemplate = 'a1Qf3000007SBc8EAG';
  27.  
  28. for(SBQQ__Quote__c quoteTMP : currentQuotes){
  29.     if((String)quoteTMP.RecordTypeId == HEREPartnerQuote
  30.       || (String)quoteTMP.RecordTypeId == HerePartnerQuoteReadOnly
  31.        || (String)quoteTMP.RecordTypeId == HerePartnerQuoteReadOnlyv2){
  32.            
  33.           quoteTMP.SBQQ__QuoteTemplateId__c = partnerTemplate;
  34.            System.debug('To jest partner ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
  35.        }else if((String)quoteTMP.RecordTypeId == Quote ||
  36.                 (String)quoteTMP.RecordTypeId == QuoteReadOnly){
  37.                    
  38.                     quoteTMP.SBQQ__QuoteTemplateId__c = simplifiedTemplate;
  39.                     System.debug('To jest zwykly quote ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
  40.                 }else if((String)quoteTMP.RecordTypeId == PriceLetter ||
  41.                          (String)quoteTMP.RecordTypeId == PriceLetterReadOnly){
  42.                              
  43.                              quoteTMP.SBQQ__QuoteTemplateId__c = priceLetterTemplate;
  44.                              System.debug('To jest price letter ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
  45.                              
  46.                          }
  47. }
  48.  
  49. update currentQuotes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement