I would like to add a schedule to my Schedulable class during the deployment of my code via Salesforce Migration Tool.

For example, one might schedule a class as per this example:

scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
String jobID = system.schedule('Merge Job', sch, m);

Is there a way to script the schedule creation during deployment with the Salesforce Migration Tool? If not with the Migration Tool itself, is there any other way of automating this?


You could have another job on a schedule whose job it is to schedule this job in question if it isn't already scheduled. I can't think of another way since you can't exercise apex on a deploy.

| improve this answer | |

Decided to use the Force.com CLI and ANT execute to run the APEX code to schedule the class.

| improve this answer | |

The only way to of automating the deployement is right now is CI, you go "Continuous Integration How-To"

| improve this answer | |
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – crmprogdev Mar 23 '15 at 20:17
  • thanks for editing Samuel, I'll take care of this in future – Abhi Tripathi Mar 24 '15 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.