---
schema_version: "1"
id: 5086264d9073eaaf996c9f44b1bfe242d91231073565bb6dd482f96b51b08612
title: invokeBatchSerially Method
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-invokebatchserially-method.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-invokebatchserially-method.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ada093ba7d8743ff514333bb43bdd12fc834cede7774323ad3cb0c66dae063df
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# invokeBatchSerially Method

Performs multiple batch operations (one after another) on a set of records.

<!-- Section title is the name of the method followed by "Method". If appropriate, precede the method name with the class name and a colon.-->

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://developer.salesforce.com/docs/industries/cme/guide/comms-t-invokebatchserially-method.md).

## Class

<!-- broken link-->

<!-- Link(s) to the class(es) to which this method belongs. If more than one class implements the same interface, use an itemized list. Don't use a link if the class itself isn't documented for users, but do list the class name.-->


## Input Parameters

`batchInput` expects the list of objects as input. Every individual object represents a single batch job to execute.

<!-- If this method has separate input and output parameters, split this section into two sections titled "Input Parameters" and "Output Parameters". Some methods of classes that implement VlocityOpenInterface2 might require an "Options Parameters" section as well.-->

| Parameter                   | Required | Description                                                                                                                                                            |
| --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| batchOperationTypeindicates | Required | The name of the batch process.                                                                                                                                         |
| batchSize                   | Required | Batch-size configuration for the batch job to run.                                                                                                                     |
| className                   | Required | The corresponding Apex class to invoke for the batch job. This class should extend MSInvokeVIPInBatch and can override start, execute, and finish methods if required. |
| classParams                 | Required | The Integration Procedures to execute at different stages of the batch job. <ul>                                                                                       |

     <li>`vipName` listed in `startVIP` is executed at the start of the batch.</li>

     <li>`executeVIP` is called as part of the execution process.</li>

     <li>`finishVIP` runs during the finish process of the batch.</li>

     <li>Additional VIP-level inputs can be provided in `vipParams`.</li>

  </ul> Also, `classParams` can contain an additional set of class-level inputs.|

## Output Parameters

| Parameter    | Description                                    |
| ------------ | ---------------------------------------------- |
| isJobStarted | True — The batch job has started successfully. |

## Example Input Data

<!-- This is usually JSON, but it could be XML or a single value. For methods of classes implementing VlocityOpenInterface2 that have options parameters, include those here.-->

```

"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

<!-- This is usually JSON, but it could be XML or a single value. Salesforce uses Return Type, but this takes care of that.-->

```

{
  "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.

```nolang
 {
  "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": {}
    }
  }
}
```
