function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michele ToscanoMichele Toscano 

Execute Anonymous Error

I'm receiving an error on Line: 1, Column 1 
System.StringException: Unexpected end of expression.

System.schedule('IMSync_At00Minutes', '0 0***?',new IncidentManagerSync());
System.schedule('IMSync_At15Minutes', '0 15***?',new IncidentManagerSync());
System.schedule('IMSync_At30Minutes', '0 30***?',new IncidentManagerSync());
System.schedule('IMSync_At45Minutes', '0 45***?',new IncidentManagerSync());

Can someone tell me what I'm doing wrong? I'm trying to execute a process every 15 minutes.  Did I get the syntax wrong somewhere?
Best Answer chosen by Michele Toscano
BenazirBenazir

Hi Michele,

Please execute your code as below format.

System.schedule('IMSync_At00Minutes', '0 0 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At15Minutes', '0 15 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At30Minutes', '0 30 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At45Minutes', '0 45 * * * ?',new IncidentManagerSync());

Thanks,
Benazir.

All Answers

LBKLBK
Hi Michele,

Can you please check if the second argument is formatted correctly?

Here is a sample code.
 
IncidentManagerSync objIncidentManagerSync = new IncidentManagerSync();
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String sch = '0 15 ? ? ? ?';
String jobID = System.schedule('IMSync_At15Minutes', sch, objIncidentManagerSync);

Also, you may have to receive the job ID into a string, even if you are not gonna use it.
LBKLBK
Small correction in the code.
 
String sch = '0 15 * * * ?';

 
BenazirBenazir

Hi Michele,

Please execute your code as below format.

System.schedule('IMSync_At00Minutes', '0 0 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At15Minutes', '0 15 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At30Minutes', '0 30 * * * ?',new IncidentManagerSync());
System.schedule('IMSync_At45Minutes', '0 45 * * * ?',new IncidentManagerSync());

Thanks,
Benazir.

This was selected as the best answer