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

  • 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 Nov 25 '19 at 5:55
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().

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.