Can anyone please tell me, what should I do to avoid this error.
Error : Loop variable must be of type Id.
What I am trying to do is,From incident object list and task object list, I am finding out the task which are linked to incident and collecting those task in list of type Id.
Below is the code which I have written. As you said to you use map here but for Id will it hold string type?
List<Id> t1=new List<Id>();
for(Integer j=0;j<resolvedIncident.size();j++)
{
for(Integer k=0;k<task.size();k++)
{
if(resolvedIncident.get(j).Id==task.get(k).BMCServiceDesk__FKIncident__c)
{
t1.add(task.get(k).BMCServiceDesk__FKIncident__c);
count=t1.size();
}
}
List<BMCServiceDesk__Task__c> T = new List<BMCServiceDesk__Task__c>();
for(BMCServiceDesk__Task__c updateTask : t1) // @ this line error
{
updateTask.BMCServiceDesk__FKStatus__c = closedStatusID.id;
T.add(updateTask);
}
Please suggest for the same. Thanks!