You need to sign in to do that
Don't have an account?

write test class for program plz?
global class CaptureLastLoginDate implements Database.Batchable<sObject>{
//This is the query that is passed to the execute method. .
String ids = UserInfo.getUserId();
String query = 'SELECT id,LastLoginDate__c FROM User ';
global database.queryLocator start(Database.BatchableContext BC) {
System.debug(query);
return database.getQueryLocator(query);
}
//close start method
global void execute(Database.BatchableContext BC, List<sObject> scope){
List<Schema.User> u = new List<Schema.User> ();
for(sObject s: Scope){
Schema.User inv = (Schema.User)s;
inv.LastLoginDate__c= inv.LastLoginDate__c;
u.add(inv);
System.debug(u);
}
update u;
}
global void finish(Database.BatchableContext sc){
}
}
//This is the query that is passed to the execute method. .
String ids = UserInfo.getUserId();
String query = 'SELECT id,LastLoginDate__c FROM User ';
global database.queryLocator start(Database.BatchableContext BC) {
System.debug(query);
return database.getQueryLocator(query);
}
//close start method
global void execute(Database.BatchableContext BC, List<sObject> scope){
List<Schema.User> u = new List<Schema.User> ();
for(sObject s: Scope){
Schema.User inv = (Schema.User)s;
inv.LastLoginDate__c= inv.LastLoginDate__c;
u.add(inv);
System.debug(u);
}
update u;
}
global void finish(Database.BatchableContext sc){
}
}

This should help you - https://developer.salesforce.com/docs/atlas.en-us.apex_workbook.meta/apex_workbook/apex_batch_2.htm