You need to sign in to do that
Don't have an account?
Roy Singh
Could anyone help me write test class for below class
Hi
public class DeactivateInactiveUsers implements Schedulable {
public void execute(SchedulableContext context) {
User[] selectedUsers = [SELECT Id FROM User WHERE IsActive = TRUE AND Id NOT IN (SELECT UserId FROM LoginHistory WHERE LoginTime = LAST_N_DAYS:8)];
for(User record: selectedUsers) {
record.IsActive = false;
}
Database.update(selectedUsers, false);
}
}
Thanks
public class DeactivateInactiveUsers implements Schedulable {
public void execute(SchedulableContext context) {
User[] selectedUsers = [SELECT Id FROM User WHERE IsActive = TRUE AND Id NOT IN (SELECT UserId FROM LoginHistory WHERE LoginTime = LAST_N_DAYS:8)];
for(User record: selectedUsers) {
record.IsActive = false;
}
Database.update(selectedUsers, false);
}
}
Thanks
I hope this will help you if it works mark question as solved
Regards
Ashif
All Answers
I hope this will help you if it works mark question as solved
Regards
Ashif
could you please tell me
String sch='0 0 23 * * ?'; how to use this ?
we set execution time of scheduler with the help of this string.
as given below.
* * * * * * *
Seconds Minutes Hours Day_of_month Month Day_of_week Optional_year
to know in detail
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
here in apex guide explained very well.
Thanks
Ashif