You need to sign in to do that
Don't have an account?
CBBsfdc
How to execute below code in anonymous window
Hi all
How to execute below code in anonymous window
kindly Support and Suggest
Thanks
How to execute below code in anonymous window
public class UserUpdate { public void updateUser(List<ID> ids){ Id userId = ids.get(0); Profile prf = [select id from Profile where Name='Work.com Only User']; User usr = [select IsActive,UserRoleId,ProfileId,Title,CompanyName,CallCenterId,DelegatedApproverId,ManagerId from User where id=:userId]; usr.UserRoleId = null; usr.ProfileId = prf.id; usr.Title = null; usr.CompanyName = null; usr.CallCenterId = null; usr.DelegatedApproverId = null; usr.ManagerId = null; usr.IsActive = false; update usr; } }Anonymous code is
List<Id> Ids = new List<Id>(); Ids.add(id); UserUpdate.updateUser(Ids);
kindly Support and Suggest
Thanks
UserUpdate userUpdate = new UserUpdate();
userUpdate.updateUser(Ids);
If you are not using a static method then you have to make reference for the above class.because you can not call a non-static method with a class name.
Try the below code-
List<Id> ids = new List<Id>();
ids.add('0050o00000Vw710AAB');
UserUpdate usr = new UserUpdate();
usr.updateUser(ids);
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi