1

As per my knowledge both future and quable are async methods ,we don't know when they run,that's y we cant pass sobjects as parametrs in fuute methods(i read in future trailhead) because objects state may change by the time it will run,but we can pass sobjects in quable does same probelm may occur for quable also rt?.But how quable solve this problem?

Thanks Ganesh

1
  • Welcome to SFSE; please see How to Ask for getting the most from the community. As best practice, we expect questions to fully spell out words (i.e. why, not y) .
    – cropredy
    Commented Nov 25, 2019 at 5:55

1 Answer 1

1

Queueables do not solve the problem of sobject state changing between the time of:

  • System.enqueueJob and
  • Queueable's execute()

The queueable interface does allow passing a snapshot of the SObject as a constructor argument (something not supported by future). This may be good enough for your application.

If you really want to make sure the queueable uses the current version of the sobject, then requery the sobject in the queueable's execute().

You must log in to answer this question.

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