public class Project_Mentor { Public static void mentors Status Available(list<Project_Mentor__c>projmentlist) { Set<id>Uniqueid =new Set<id>(); for(Project_Mentor__c Pm:projmentlist) { Uniqueid.add(Pm.Mentor__c ); } list<Mentor__c> mntlist = [SELECT id,Name From Mentor__c WHERE id IN: Uniqueid]; //List<Project_mentor__c>pmlist=[SELECT id,Name FROM Project_mentor_c WHERE id iN : Uniqueid]; for(Mentor__c ment: mntlist) { for(Project_Mentor__c Pm:projmentlist) { if((Pm.Status__c=='Completed') && (Pm.Mentor__c==ment.id)) { Ment.Status__c ='Available'; } } } if(projmentlist.size() > 0) { try{ Update mntlist; } Catch(Exception EX){ System.debug(EX); } } } }
Hello,
Just checking in to see if you need any further help on this, if this is now answered sufficiently then please select a Best Answer!