---
schema_version: "1"
id: 4ef819ff790e6fa40b83671d822e5985117ba99bc6d3aaec62ae978d8f4467f9
title: invokeBatchSerially Method
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_t_invokebatchserially_method_216041.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_t_invokebatchserially_method_216041.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 89efcae32c42234acb70f9fb03dc01b684be4c62873024061c9ea65b7ad6f535
description: Performs multiple batch operations (one after another) on a set of records.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# invokeBatchSerially Method

Performs multiple batch operations (one after another) on a set of records.

It executes a number of Integration Procedures-based batch jobs in succession. It also supports the pre and post-processing steps on every batch.

For example, you could use it for various group-level (Quote/Order Group) actions to perform different sequential batch jobs on a set of quotes and orders.

1. Validate and Price:
    
    - Validation
    - Pricing (gets fired once the validation batch-job is finished)
2. Create and Submit Order:
    
    - Create Order (Quote checkout with price:false)
    - Price Sub-Orders
    - Submit Order (checkout the orders created in the initial batch)

For other uses, see [invokeBatchSerially Method](https://help.salesforce.com/s/articleView?id=ind.comms_t_invokebatchserially_method_216041.htm&release=264.0.0&type=5 "Performs multiple batch operations (one after another) on a set of records.").

## Class

## Input Parameters

`batchInput` expects the list of objects as input. Every individual object represents a single batch job to execute.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d246326e129">
              <p style="margin-bottom:0;">Parameter</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d246326e135">
              <p style="margin-bottom:0;">Required</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d246326e141">
              <p style="margin-bottom:0;">Description</p>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e129 ">
              <p style="margin-bottom:0;">batchOperationTypeindicates</p>
            </td>

            <td data-label="Required" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e135 ">
              <p style="margin-bottom:0;">Required </p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e141 ">
              <p style="margin-bottom:0;">The name of the batch process.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e129 ">
              <p style="margin-bottom:0;">batchSize</p>
            </td>

            <td data-label="Required" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e135 ">
              <p style="margin-bottom:0;">Required </p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e141 ">
              <p style="margin-bottom:0;">Batch-size configuration for the batch job to run.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e129 ">
              <p style="margin-bottom:0;">className</p>
            </td>

            <td data-label="Required" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e135 ">
              <p style="margin-bottom:0;">Required</p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e141 ">
              <p>The corresponding Apex class to invoke for the batch job.</p>
              <p style="margin-bottom:0;">This class should extend <span class="apiname">MSInvokeVIPInBatch</span> and can override <span class="apiname">start</span>, <span class="apiname">execute</span>, and <span class="apiname">finish</span> methods if required.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e129 ">
              <p style="margin-bottom:0;">classParams</p>
            </td>

            <td data-label="Required" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e135 ">
              <p style="margin-bottom:0;">Required</p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e141 ">
              <p>The Integration Procedures to execute at different stages of the batch job.</p>
              <ul>
                <li>
                  <p><code>vipName</code> listed in <code>startVIP</code> is executed at the start of the batch. </p>
                </li>

                <li>
                  <p><code>executeVIP</code> is called as part of the execution process.</p>
                </li>

                <li>
                  <p><code>finishVIP</code> runs during the finish process of the batch.</p>
                </li>

                <li>
                  <p>Additional VIP-level inputs can be provided in <code>vipParams</code>.</p>
                </li>

              </ul>
              <p style="margin-bottom:0;">Also, <code>classParams</code> can contain an additional set of class-level inputs.</p>
            </td>

          </tr>
        </tbody>
      </table>

## Output Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d246326e314">
              <p style="margin-bottom:0;">Parameter</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d246326e320">
              <p style="margin-bottom:0;">Description</p>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e314 ">
              <p style="margin-bottom:0;">isJobStarted</p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d246326e320 ">
              <p style="margin-bottom:0;">True — The batch job has started successfully.</p>
            </td>

          </tr>
        </tbody>
      </table>

## Example Input Data

```

"batchInput": [
  {
    "batchOperationType": "Validate",
    "batchSize": 1,
    "className": "vlocity_cmt.MSInvokeCartValidationBatch",
    "classParams": {
      "startVIP": {
        "vipName": "",
        "vipParams": {}
      },
      "executeVIP": {
        "vipName": "MultiService_RunCartValidation",
        "vipParams": {}
      },
      "finishVIP": {
        "vipName": "MultiService_FinishCartValidation",
        "vipParams": {}
      }
    }
  },
  {
    "batchOperationType": "Price",
    "batchSize": 1,
    "className": "vlocity_cmt.MSInvokeCartPricingBatch",
    "classParams": {
      "startVIP": {
        "vipName": "",
        "vipParams": {}
      },
      "executeVIP": {
        "vipName": "MultiService_RunCartPricing",
        "vipParams": {}
      },
      "finishVIP": {
        "vipName": "MultiService_FinishCartPricing",
        "vipParams": {}
      }
    }
  }
]            
 
```

## Example Output Data

```

{
  "isJobStarted": "false",
  "error": "OK",
  "errorLabel" : "Batch Job Failed to Start",
  "message": "Batch job cannot be started as salesforce limit exceeded. Please contact administrator."
}
            
```

## Process Different Records

This remote action can also support the scenario where the next batch is expected to process a different set of records than the previous one.

For example, in the Create and Submit Order batch, the finish stage of Create-Order and the whole Price and Submit-Order batches should process the new orders created by the previous batch. This is possible by splitting the finish of the Create-Order process into three steps:

1. Run `beforeCtxSwitchFinishVIP`.
2. Perform context switch.
3. Run `afterCtxSwitchFinishVIP`.

The corresponding batch-object of the input is shown in the following example.

```
 {
  "batchOperationType": "CreateOrder",
  "batchSize": 1,
  "className": "vlocity_cmt.MSInvokeCreateOrderBatch",
  "classParams": {
    "startVIP": {
      "vipName": "MultiService_StartCheckoutQuote",
      "vipParams": {}
    },
    "executeVIP": {
      "vipName": "MultiService_CheckoutQuote",
      "vipParams": {}
    },
    "beforeCtxSwitchFinishVIP": {
      "vipName": "",
      "vipParams": {}
    },
    "afterCtxSwitchFinishVIP": {
      "vipName": "MultiService_FinishCheckoutQuote",
      "vipParams": {}
    }
  }
}
```