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. 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. Commented Jan 7, 2020 at 18:23
  • see updated answer; why can't you abort the job in your sandbox? 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. Commented Jan 7, 2020 at 19:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.