Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<SBQQ__Quote__c> currentQuotes = [SELECT Id,
- SBQQ__QuoteTemplateId__c,
- RecordTypeId FROM SBQQ__Quote__c where
- (sbqq__quotetemplateid__c = null OR SBQQ__QuoteTemplateId__c = '')
- AND SBQQ__Status__c != 'In Draft'
- AND SBQQ__Status__c != 'Rejected'
- AND RecordTypeId != '012f3000000gzaXAAQ'
- AND RecordTypeId != '012f3000000gzaYAAQ'
- AND RecordTypeId != null limit 100];
- String AutomotiveQuote = '012f3000000gzaXAAQ';
- String AutomotiveQuoteReadOnly = '012f3000000gzaYAAQ';
- String HEREPartnerQuote = '012f3000000YbcGAAS';
- String HerePartnerQuoteReadOnly = '012f3000000Ybg1AAC';
- String HerePartnerQuoteReadOnlyv2 = '012f3000000YbcHAAS';
- String PriceLetter = '012f3000000gzZFAAY';
- String PriceLetterReadOnly = '012f3000000gzZLAAY';
- String Quote = '012f3000000gzZGAAY';
- String QuoteReadOnly = '012f3000000gzZMAAY';
- String priceLetterTemplate = 'a1Qf3000006R82AEAS';
- String simplifiedTemplate = 'a1Qf3000006R82BEAS';
- String partnerTemplate = 'a1Qf3000007SBc8EAG';
- for(SBQQ__Quote__c quoteTMP : currentQuotes){
- if((String)quoteTMP.RecordTypeId == HEREPartnerQuote
- || (String)quoteTMP.RecordTypeId == HerePartnerQuoteReadOnly
- || (String)quoteTMP.RecordTypeId == HerePartnerQuoteReadOnlyv2){
- quoteTMP.SBQQ__QuoteTemplateId__c = partnerTemplate;
- System.debug('To jest partner ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
- }else if((String)quoteTMP.RecordTypeId == Quote ||
- (String)quoteTMP.RecordTypeId == QuoteReadOnly){
- quoteTMP.SBQQ__QuoteTemplateId__c = simplifiedTemplate;
- System.debug('To jest zwykly quote ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
- }else if((String)quoteTMP.RecordTypeId == PriceLetter ||
- (String)quoteTMP.RecordTypeId == PriceLetterReadOnly){
- quoteTMP.SBQQ__QuoteTemplateId__c = priceLetterTemplate;
- System.debug('To jest price letter ->' + quoteTMP.SBQQ__QuoteTemplateId__c);
- }
- }
- update currentQuotes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement