function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iqbaliqbal 

asynchronous methods

Hi,

We have written a trigger which calls an asynchronous method to perform certain functionality.

In some cases, this asynchronous method might be called 5-10 times at the same time and all the methods run parallely at the same time.

In this situation, can we make sure that the multiple copies of this asynchronous method run sequentially one after the other. Kindly let me know how this can

be done.

 

Thanks,

Asif Iqbal

aalbertaalbert
Why don't you invoke 1 method asynchrnously and in that logic process sequentially? That way you have more control.
iqbaliqbal

Hi Aalbert,

Thanks for your reply.

The asynchronous method is called by trigger whenever records are inserted, so multiple executions of asynchronous method can run. In addition, salesforce system may keep all the executions of aysnchronous method in queue and schedule it to run at the same time in future.

 

Also please let me know, is there any way where we can find out the number of asynchronous method currently running.(number of thread)