1

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?

1 Answer 1

6
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.

4
  • 1
    Also available via the Metadata API. Still not a good idea.
    – David Reed
    Commented Jan 7, 2020 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
    Commented Jan 7, 2020 at 18:23
  • see updated answer; why can't you abort the job in your sandbox?
    – cropredy
    Commented Jan 7, 2020 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
    Commented Jan 7, 2020 at 19:41

You must log in to answer this question.

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