Hello friends, in this post we will discuss about a salesforce error that sometime occurred when you trying to schedule an apex scheduler class using apex code. so, let's understand when this error occurred, and how we can fix this.

System.AsyncException: trigger must be associated with a job detail

Suppose you are going to schedule a scheduler class using below code.
 MySchedulerClass objSch = new MySchedulerClass();
 String cronexp = '0 0 10 * * ?';
 System.schedule('My Scheduler ', cronexp, objSch);
When you trying to execute the above code, you will get the below error.


So, what is the reason behind this error, if you notice there is a space after "My Scheduler ", when I removed this extra space from the name ("My Scheduler") my code was scheduled as expected.

Point to Remember: - Please do avoid extra space after scheduler name while scheduling any class. You can put space between scheduler name but not after the name.

Hope you like this post, for any feedback or suggestions please feel free to comment. I would appreciate your feedback and suggestions.
Thank you.