Skip to main content Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.
error

Realizamos un giro incorrecto. Inténtelo de nuevo.

Anuj Kumar (ABC) preguntó en #Apex
Hi All,

1. we know that we can not call a future from a batch or from another future because both are asynchronous. But we can call a batch from another        batch even batchs also asynchronous. I googled it but did not get any proper answer. could you please suggest your views ont his.

2. we can call a batch from another batch only from start or finish method but not from execute method, why?

Any response would be appriciated.

Thanks,

Anuj

 
2 respuestas
  1. 17 dic 2018, 9:18 a.m.
    Hi Anuj,

    1) Usually we are not supposed to give a call from the asynchronous to asynchronous because we don't know when it get worked (executed when the source is available only). In terms of batch class we can do this only in the finish method, there only we can understand the another batch can execute after completion of one batch this is the exceptional case.

    2) Can call batch class to batch class in only finish not possible​ in the start method. If we call the 2nd batch class in the execute method we may have a possibility to call the second batch once the some group of the records has been processed that would not be much effective for whole process.

    Regards |Rajesh | Technician
  2. 17 dic 2018, 9:55 a.m.
    hi Rajesh,

    Thanks for your quick response.

    Refards,

    Anuj
0/9000