1

Is there a way to make synchronous call in sales force ?

Assume that i am running two lines of code in developer console and i want the second line to get executed only if my first line gets completed.

My first line could be a batch job also. So basically if my first line is going to be a batch job call i need t wait till all my batch job gets completed then i should run by second command in the developer console. Please provide some pointer if this is possible in sales force.

Thanks, Balaji.

2
  • 4
    This is not possible in the way you describe it. A call to a batch is asynchronous by definition. The batch will be started after the execution in which it was created was committed. You can use the finish() method in the Batchable interface for stuff that needs to happen after the batch is finished. – rael_kid Dec 11 '15 at 13:45
  • @Lex, you should post this as the answer to the question. You're spot on. – crmprogdev Dec 11 '15 at 14:50
6

This is not possible in the way you describe it. A call to a batch is asynchronous by definition. The batch will be started after the execution in which it was created was committed. You can use the finish() method in the Batchable interface for stuff that needs to happen after the batch is finished. Read the documentation for batches for more information.

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.