i am not sure why this error is shown,when i am mapping a new ID against and ID field.
Here i am trying to achieve this requirement : Want to do this for existing user. So i have queried the set of users [into list variable user}for which now I want to update the ManagerId with a new Id. Which you can see it in : for loop i am trying to update the set of users in the list with updated ManagerId and then adding it to TrsfrMgr list. But that assignment itself isnot working.
Can someone please help!!
List<User> FromMgrId ,ToMgrID ;
ToMgrID = [select Id from User where name=: ToMgr] ;
for (User a : user)
{
system.debug('OLDMgrId' + a.ManagerId);
a.ManagerId = (ID) ToMgrID.Id;
TrsfrMgr.add(a);
}