You need to sign in to do that
Don't have an account?
Regarding the scheduler class
Hi Everone,
I wrote this code for scheduler class ,but when i look in below path
Setup->Monitoring->Scheduled Jobs i am not able be to see my class .
global class Schecudlertestaccount22 implements Schedulable {
Schecudlertestaccount22 c = new Schecudlertestaccount22();
global void execute(SchedulableContext ctx) {
String sch = '0 6 * * * ? ';
system.schedule('Schecudlertestaccount', sch, c);
Account acct= new Account();
//acct.Type
acct=[SELECT id, Type from Account where Type='Other'];
acct.Site='www.abc.com';
update acct;
}
}
Can any one pl suggets on this
Regards
madhu
use something like this instead
All Answers
Hi Madhu
try in developer console
copy this and excute in developer console
Schecudlertestaccount22 c = new Schecudlertestaccount22();
String sch = '0 6 * * * ? ';
system.schedule('Schecudlertestaccount', sch, c);
regards
venkatesh.
caused by: System.QueryException: List has more than 1 row for assignment to SObject
when the below code excutes i am getting the error
global class Schecudlertestaccount22 implements Schedulable {
//Schecudlertestaccount22 c = new Schecudlertestaccount22();
global void execute(SchedulableContext ctx) {
Account acct = new Account();
acct=[SELECT id, Type from Account where Type='Other'];
acct.Site='www.abc.com';
update acct;
system.debug(acct);
}
}
Regards
Madhu
Hi Madhu
i think you are getting these error becuase your condition is not meeting condition
means this
acct=[SELECT id, Type from Account where Type='Other'];
please check in account is there any record type=other
and once check in the debug log what you are getting the update records.
Regards
venkatesh.
use something like this instead
Problem: Initial term of field expression must be a concrete SObject: LIST<Account>
Suppose if they are 10 records and i need to update i created a list and But i am getting the error below
global class Schecudlertestaccount22 implements Schedulable {
//Schecudlertestaccount22 c = new Schecudlertestaccount22();
List<Account> acct = new List<Account>();
Set<Id> ids=new Set<Id>();
global void execute(SchedulableContext ctx) {
acct=[SELECT Id from Account where Type='Other' limit 1];
for(integer i=0; i <acct.size();i++)
{
for(Account acctt:acct)
{
ids.add(acct.Id);
//acctt.Site = 'www.abc.com';
}
}
update acct;
}
}
How i need to write that code can some one pl help me out
is this what you are looking for?