• Shamily
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Hi ,

I'm trying to write a batch apex on User. I have to capture the system generated lastlogindate into the custom field called LastLoginDate__c For this i wrote a code which is as below.

global class SearchAndReplace implements Database.Batchable<sobject>{

global final String Query;
global final String Entity;
global final String Field;
global final String Value;

global SearchAndReplace(String q, String e, String f, String v){

Query=q; Entity=e; Field=f;Value=v;
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<User> scope){
for(User u:Use)
{
u=[select LastLoginDate from User where Id=:UserInfo.getUserId()];
u.LastLoginDate__c=u.LastLoginDate;

u.put(Value);
}
update use;
}

global void finish(Database.BatchableContext BC){
}
}

The error what i get is Error: Compile Error: Argument type of global method must also be global: LIST<User> at line 17 column 16.

could any one guide me.Thank you in advance

Hi ,

I'm trying to write a batch apex on User. I have to capture the system generated lastlogindate into the custom field called LastLoginDate__c For this i wrote a code which is as below.

global class SearchAndReplace implements Database.Batchable<sobject>{

global final String Query;
global final String Entity;
global final String Field;
global final String Value;

global SearchAndReplace(String q, String e, String f, String v){

Query=q; Entity=e; Field=f;Value=v;
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<User> scope){
for(User u:Use)
{
u=[select LastLoginDate from User where Id=:UserInfo.getUserId()];
u.LastLoginDate__c=u.LastLoginDate;

u.put(Value);
}
update use;
}

global void finish(Database.BatchableContext BC){
}
}

The error what i get is Error: Compile Error: Argument type of global method must also be global: LIST<User> at line 17 column 16.

could any one guide me.Thank you in advance