You need to sign in to do that
Don't have an account?

error on Database.SaveResult - Error: Compile Error: Variable does not exist: srList at line 25
Database.SaveResult[] srList = Database.insert(alltktReqLst, false); // Iterate through each returned result for (Database.SaveResult sr : srList) {}I am getting error when I try to iterate through result set. I tested that the insert statement is working and records are inserted. HELP please, why is variable does not exists for srList?
please check what alltktReqLst is returning in your code by system.debug(alltktReqLst);
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database_saveresult.htm
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
It seems like the line Database.SaveResult[] srList = Database.insert(alltktReqLst, false); is in some if condition which is not beeing executed all times, eventually variable srList not initiating and it is throwing variable doesn't exist error.
Declare List at the starting of class/trigger . Let me know if it works.
Thanks,
Nagendra