Things to Remember while working with Queueable Apex:

  1. Queueable class can contain member variables of non-primitive data types, such as sObjects or custom Apex types. Those objects can be accessed when the job executes.
  2. System.enqueueJob method, the method returns the ID of the AsyncApexJob record which can be used to identify and monitor the progress of the job, either through Salesforce UI in Apex jobs or by querying from AsyncApexJob.
  3. Chaining of one job to another job by starting a second job from a running job is possible.
  4. We can’t chain queueable jobs in an Apex test, doing so results in an error. To avoid errors, we can check if Apex is running in test context by calling Test.isRunningTest() before chaining jobs.
  5. We can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.
  6. When chaining jobs, we can add only one job from an executing job with System.enqueueJob
  7. No limit is enforced on the depth of chained jobs. However, for Developer Edition and Trial orgs, the maximum stack depth for chained jobs is 5.
Like it ? Share : Do Nothing

Leave a Reply