global class scheduledMonthly implements Schedulable {
global void execute(SchedulableContext sc) {
List<User> lstUser=new List<User>();
for(User obj:[SELECT id,name,lastlogindate,isActive FROM User where lastlogindate<=LAST_N_DAYS:30])
{
User objNew=obj.id;
objNew.isActive=false;
lstUser.add(objNew)
}
if(lstUser!=null && lstUser.size()>0)
{
update lstUser;
}
}
}
No comments:
Post a Comment
Thanks for your comment