vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Class SalesforceBatchService

    Index

    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

      • Optionalpredicate: (job: SalesforceBatchJob) => 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?:
                      | BatchAwaitOptions
                      | ((status: SalesforceBatchJobStatus) => any),
              ) => 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

      predicate to narrow the batches to await.

      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();