Error : "Trigger must be associated with a job detail"

Error : "Trigger must be associated with a job detail"

Hi All,
I was just trying to schedule my schedulable class 'Schedular_GlobalAppLogPurgeBatch' in Apex. That time I was facing this error.
Error : "Trigger must be associated with a job detail"

e.g.
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge ', '0 0 * * * ? *', globalPurgeBatchSchedular);

you can notice there is a space after "Global App Logs Purge ", when I removed this extra space from the name ("Global App Logs Purge") my class was scheduled as expected.

Corrected Space from code:
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge', '0 0 * * * ? *', globalPurgeBatchSchedular);

I hope this will help you.

Comments

Popular posts from this blog

System.AsyncException: The Apex job named is already scheduled for execution.

Custom Setting Creation in Apex Test Class

AJAX Toolkit Debug Shell

Salesforce Trace Log Query Using Apex

how to get object name from id / prefix value in salesforce

How to Query All the batch classes in your Salesforce Instance using APEX

Creating Salesforce Developer Account

Creating MAP from SOQL Query

Custom Pagination Without Controller (Apex)