Find your content:

Search form

You are here

System.ListException: List index out of bounds: 0 error for Custom Employee Profile User

 
Share

I HAVE ALSO TRIED "isEmpty()"
When i create new User Account and login with that credentials, it gives me this problem if admin doesnt have set thier values yet !!!

AllotmentList = [select id, Days_Remaining__c from PTO_Allotment__c where Year__c =:year and Employee__c=:EmployeeList[0].id LIMIT 100]; //access only Current user Allotment details //to handle Listoutof Bound Exception wrote if-else

    if(AllotmentList.size()>0)
    {
    requests.PTO_Allotment__c=AllotmentList[0].id;
    requests.Days_Remaining__c=AllotmentList[0].Days_Remaining__c;
    }
    else
    {
        //write a code when AllotmentList is empty ....

   }

Attribution to: Nilesh
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33160

My Block Status

My Block Content