Hi ,
I have a Batch execute method as below. I'm trying to update the my list. But the list isn't getting updated.
Not sure where am I going wrong.
public static void updateFlatRenewalOnQuote(List<SBQQ__Quote__c> quoteList){
Set<Id> opptyIdSet = new Set<Id>();
Map<Id, SBQQ__Quote__c> opptyIdQuoteMap = new Map<Id, SBQQ__Quote__c>();
if(!quoteList.isEmpty()){
for(SBQQ__Quote__c quote : quoteList){
opptyIdQuoteMap.put(quote.Id, quote);
system.debug('opptyIdQuoteMap issssssssssssssssssssssssssssssssssss'+opptyIdQuoteMap);
opptyIdSet.add(quote.SBQQ__Opportunity2__c);
system.debug('opptyIdSet issssssssssssssssssssssssssssssss'+opptyIdSet);
}
}
Map<Id, Opportunity> opptyMap = new Map<Id, Opportunity>([Select Id, Expected_Renewal_Amount__c, Prior_Opportunity__c from Opportunity where Id IN: opptyIdSet]);
List<SBQQ__Quote__c> newQuoteList = new List<SBQQ__Quote__c>();
if(!quoteList.isEmpty()){
for(SBQQ__Quote__c quote : quoteList){
if(opptyIdQuoteMap.get(quote.Id).SBQQ__NetAmount__c == opptyMap.get(opptyIdQuoteMap.get(quote.Id).SBQQ__Opportunity2__c).Expected_Renewal_Amount__c &&
opptyMap.get(opptyIdQuoteMap.get(quote.Id).SBQQ__Opportunity2__c).Prior_Opportunity__c != null &&
opptyIdQuoteMap.get(quote.Id).LineItemCount_VirusTotal__c == opptyIdQuoteMap.get(quote.Id).SBQQ__LineItemCount__c) {
quote.Is_Flat_Renewal__c = true;
quote.ApprovalStatus__c = 'Approved';
}
}
system.debug('Update Quote List ::::'+quoteList);
update quoteList;
}
}
Hi Kavita,
Are you facing any exceptions?
Try setting system.debug statements at each step, and check for any errors in your debug log. When you set the debug statements at each step, you'll get to know what value you're getting at each step in each iteration, and will also come to know if there is any exception. In the debug logs, you'll also get the line number of exception (if there is any), then you should be able to fix. If not, please share the debug log, then we would be able to help you.