Hierarchy

  • SalesforceBatchService

Constructors

Properties

logger: Logger
queryService: QueryService
salesforceService: SalesforceService

Methods

  • Track batches created scheduled from now and allow those batches to be queried and awaited. By default the tracker will track all batches created by the current user. Use the optional

    Parameters

    • Optional predicate: ((job) => boolean)

      Optional predicate which filters the batches to await; if the predicate returns false the batch is ignored otherwise it is awaited

    Returns Promise<{
        awaitScheduledBatches: ((options?) => Promise<void>);
        scheduledBatches: (() => Promise<SalesforceBatchJob[]>);
    }>

    Object with a scheduledBatches property which returns a promise which resolves to an array of scheduled batches and a awaitScheduledBatches method which awaits all scheduled batches

    See

    predicate to narrow the batches to await.

    Example

    const tracker = await batchService.createBatchTracker(job => job.apexClass === 'MyBatchClass');
    salesforceService.executeAnonymous('System.scheduleBatch(new MyBatchClass(), \'MyBatchClass\', 1);');
    salesforceService.executeAnonymous('System.scheduleBatch(new MyNonAwaitedBatchClass(), \'MyNonAwaitedBatchClass\', 1);');
    await tracker.awaitScheduledBatches();