We have a scheduled job running every 5 minutes in an org. We want to add a cleanup/health-check tasks that runs every 24 hours. Typically we would want to run it at 12:00 am on the customer's org.

Should we be creating another job for this?

Or can we hookup the cleanup code in the current job itself to run based on a given time. This is the preferred approach for us since there would be only one job running. But we aren't sure if this is the best way to go since we would have to call tasks based on org time. Any inputs on how to achieve this?

1 Answer 1


A scheduled job that runs in my org every 5 minutes would annoy the me and by making that job take even longer would annoy me even more, I don't know why there is a need to run a job every 5 minutes so I believe we would need more details but I would create a new process and reevaluate why I need this other job every 5 minutes.

You could only have 1 job, but that one job would handle 2 process and would run all together, you cannot split it up through code. For simplicity sake by creating 2 different jobs you would have more control over the 2 processes.

  • Thanks for your input. The schedule is configurable and is up to the subscriber. It is a critical job which is processing incoming data and hence needs to run at that interval. Yeah perhaps making them 2 jobs makes more sense. I'm just worried that they do not run into race issues.
    – Tan
    Jul 25, 2017 at 5:20
  • If it was designed correctly there shouldn't be an issue with a race condition, I don't know what your solving for but you should take care in the design of your second one.
    – EricSSH
    Jul 25, 2017 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .