Hi I have a code which makes an apex callout to a external system. I query a list of records and loop it through to make a callout. Example code:
try{
List<object__c> s= [select.....records];
for(object__c rr : s){
var1 = rr.field1__C;
var2 = rr.field2__c;
var3 = rr.field3__c;
}
}
catch(Exception e){
system.debug('****' + e.getMessage());
}
In my above code I am looping through all the records that were queried and setting it up in the variable which are part of the callout request.
My problem: Var1 field is a required field by external system. There is an exception if the field1__c
value is missing any record. It gives a null pointer exception if the value is not there. If one record does not have this value the programs goes into the exception block and stops the process. I want the program to process the other records which has the field1__c value available. How can I make other record process even though one record fails to make a callout?