You need to sign in to do that
Don't have an account?
monkeyking
Null exception : System.ListException: List index out of bounds: 0
Hello All,
Below is my code,
List<Case> localemailaddress = new List<Case>([SELECT ID,AV_Local_Affiliate_Inbox__c FROM Case Where Id IN : newCaseMap.keySet()]);
if(localemailaddress.size()>0){
String email=String.valueOf(localemailaddress.get(0));
system.debug('Raj debug' +email);
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address =:email];
Eventhough i checked for Null case exception. I am gettingSystem.ListException: List index out of bounds: 0 this erroe.
Can anyone please tell me why ?
Urgent !!
Thanks in advance.
Below is my code,
List<Case> localemailaddress = new List<Case>([SELECT ID,AV_Local_Affiliate_Inbox__c FROM Case Where Id IN : newCaseMap.keySet()]);
if(localemailaddress.size()>0){
String email=String.valueOf(localemailaddress.get(0));
system.debug('Raj debug' +email);
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address =:email];
Eventhough i checked for Null case exception. I am gettingSystem.ListException: List index out of bounds: 0 this erroe.
Can anyone please tell me why ?
Urgent !!
Thanks in advance.
Try this
String email=String.valueOf(localemailaddress.get(0).AV_Local_Affiliate_Inbox__c);
Also, I am not sure why you are hardcoding the index value of "0" but I would iterate through the list because you will have more than one record returned in the query. Plus this bulkifies.
Hope if works out.
Thanks,
Sridhar
That is why i am using this.