You need to sign in to do that
Don't have an account?
hiteshwar marni
batch apex error1
I'm writing below batch apex to transfer the accounts of particualr user to another user
bu it's throwing error as " EXCEPTION_THROWN [7]|System.QueryException: unexpected token: 'Eo3Z' ".
Thanks
global class accountownerhangebatch implements database.batchable<sobject>{
global database.querylocator start(database.batchablecontext bc){
string query = 'select Name,Ownerid from account where ownerid = 00528000001Eo3Z' ;
return database.getquerylocator(query);
}
global void execute (database.batchablecontext bc, list<Account> scope){
id oid = 'SELECT Id,name FROM User WHERE name = marni user1';
for(account a : scope){
a.Ownerid= oid;
system.debug('---->'+a.Ownerid);
}
update scope;
}
global void finish(database.batchablecontext bc){
}
}
bu it's throwing error as " EXCEPTION_THROWN [7]|System.QueryException: unexpected token: 'Eo3Z' ".
Thanks
global class accountownerhangebatch implements database.batchable<sobject>{
global database.querylocator start(database.batchablecontext bc){
string query = 'select Name,Ownerid from account where ownerid = 00528000001Eo3Z' ;
return database.getquerylocator(query);
}
global void execute (database.batchablecontext bc, list<Account> scope){
id oid = 'SELECT Id,name FROM User WHERE name = marni user1';
for(account a : scope){
a.Ownerid= oid;
system.debug('---->'+a.Ownerid);
}
update scope;
}
global void finish(database.batchablecontext bc){
}
}
Let us know if this will help you
thanks for your reply
when i'm trying to use your code it's throwing Error: Compile Error: line breaks not allowed in string literals at line 7 column -1