I am trying to figure out if we can save a class which is used in a batch job.

I am unable to save a class. I can't save the class when a batch job is running. I don't want to abort the job. Is there another way, except the Ant tool, I can save this class?

Setup | Deployment Settings | Allow deployments of components when corresponding Apex jobs are pending or in progress.

Caution: Enabling this option may cause Apex jobs to fail.

The above applies to deploying into a target org

If you are developing in a sandbox, and you are editing an apex class that is used in a running job of that sandbox, you need to abort the job in order to save the class.

  • 1
    Also available via the Metadata API. Still not a good idea. – David Reed Jan 7 at 18:20
  • I also did that but it's not working, so I am in a sandbox I also can't deploy on this sandbox, but I can't abort the job. – Malik Jan 7 at 18:23
  • see updated answer; why can't you abort the job in your sandbox? – cropredy Jan 7 at 18:27
  • @Malik You won't be able to save (Tooling restriction). You can use workbench, sfdx, ant toolkit, etc, but the Developer Console won't be able to. – sfdcfox Jan 7 at 19:41

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.