function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkatesh LVenkatesh L 

How to Create a batch class which runs daily with the help of scheduled class and deactivates users whose last login date is greater than 10 days

Subramani_SFDCSubramani_SFDC
List<User> users = [Select LastLoginDate , IsActive, Id From User where LastLoginDate < :Date.today().addDays(-10)];
for(User u : users)
{
	u.IsActive = False;
}
update users;

use the above query in your batch class and create scheduler class and activate the scheduler daily using apex scheduler button