Activity Forums Salesforce® Discussions When a BatchApexworker record is created in batch apex in salesforce?

  • Anjali

    Member
    August 6, 2018 at 5:47 am

    Hi suniti,

    For each 10,000 AsyncApexJob records, Apex creates one additional AsyncApexJob record of type BatchApexWorker for internal use. When querying for all AsyncApexJob records, it is recommend that you filter out records of type BatchApexWorker using the JobType field. Otherwise, the query will return one more record for every 10,000 AsyncApexJob records.

  • Parul

    Member
    September 15, 2018 at 5:06 am

    BatchApexworker  is an picklist value in AsysncApexJob Object . When ever you will execute an Batch apex in salesforce it will  create two record in AyncApexJob Object with two different JobType (BatchApex/BatchApexWorker) .
    The record with jobType BatchApexWorker  will contain the last processed recordid and ParentJobId as the reocrd with Jobtype BatchApex .

     

    Thanks

  • shariq

    Member
    September 15, 2018 at 5:36 pm

    Hi,

    To add more -

    BatchApexworker used internally by Salesforce. For each 'AsyncApexJob' record of type 'BatchApex', Apex creates for internal use an 'AsyncApexJob' record of type 'BatchApexWorker' per 10,000 records to be processed. When querying for all 'AsyncApexJob' records, we recommend that you filter out records of type 'BatchApexWorker' using the 'JobType' field to avoid returning more than one record for each 'AsyncApexJob' record of type 'BatchApex.'

    Hope this helps.

  • shradha jain

    Member
    September 17, 2018 at 10:02 am

    Hello suniti,

    Each time batch Apex is invoked, it creates an AsyncApexJob record. You can use the ID of this record to construct a SOQL query to retrieve the job’s status and progress. Apex creates one additional AsyncApexJob record of type BatchApexWorker for internal use for every 10,000 AsyncApexJob records.

Log In to reply.

Popular Salesforce Blogs