I am able to get the debug System.debug('debugging inside inv res ');But unable to get the debug System.debug('inside result of invoices for errorlogging');Can somebody please help me why this strange behaviour is coming as I need to insert the errorlogs records and because of this issue my error logs are not getting inserted. Please help me or suggest what should I do.Database.saveResult[] res= Database.insert(invoiceList,false);
Integer result2=res.size();
System.debug('inserted invoices for SA=BA'+res);
System.debug('result size for errorlogs loop '+result2);
if(res.size()>0)
{
System.debug('debugging inside inv res ');
for(Integer i=0; i< res.size(); i++)
{
System.debug('inside result of invoices for errorlogging');
if(!res.get(i).isSuccess())
{
Database.Error errors = res.get(i).getErrors().get(0);
Event_Tracker__c erlog=new Event_Tracker__c();
erlog.Error_Description__c='Invoice creation failed for SA=BA'+'\n'+String.valueof(res.get(i).getErrors().get(0))+'\n'+invoiceList[i];
erlog.name='Script 2 - 2 ST_DataTransformationBatch Script has error';
erlog.Error_Object__c=invoiceList[i].Opportunity__c;
erlog.recordtypeid=evtrecordtypeid;
errorlogsList.add(erlog);
scriptfailedoptId.add(invoiceList[i].Opportunity__c);
}
if(res.get(i).isSuccess())
{
optyVsInvoiceId.put(invoiceList[i].Opportunity__c,invoiceList[i].Id);
}
}
}
error
Close