CPQCreateSuspendOrder: Create suspension order for Vlocity CPQ - sashavmorozov/vlocity-utilities GitHub Wiki

Revision History

Version Date Changed By Description Reference
0.1 Apr 23, 2019 [email protected] Initial draft

Purpose

The interface can be used by a frontend application or an omniscript to create a suspension request for currently active customer assets (identified by unique asset IDs). The order is created but not submitted. One can use XOMSubmitOrder to submit the created suspension request to fulfillment through Vlocity order management.

The integration procedure uses standard Vlocity CPQ API to create an asset-based order.

This interface can be consumed by:

  • front-end application
  • guided process (ordering, care, etc.)

Interface: REST (POST)

Engine: Vlocity Integration Procedure

Endpoint: /services/apexrest/vlocity_cmt/v1/integrationprocedure/Otter_CPQCreateSuspendOrder

Input Parameters

Parameter Mandatory Type Default Description Example
accountId Yes String Salesforce ID of the asset owner (customer account) 0014J000003QMHB
requestDate Yes Date Requested order date in yyyy-MM-dd format 2019-12-01
assets Yes String Salesforce IDs of assets to suspend in a form of a concatenated string. Case-safe Salesforce IDs (18 digits, not 15 digits) should be used in this field. This can be a list of only root assets or the entire hierarchy of assets to suspend. Only currently active assets should be provided in this field (exclude already suspended or disconnected assets if applicable) 02i4J000000HQ83

One can extend the interface to add additional input parameters like Suspension Reason, Suspension Period, etc.

Business Logic

The procedure performs the following logic:

  1. Input data validation (according to the Input Parameters section)
  2. Shell asset-based order creation (using Vlocity CPQ API assetToOrder)
  3. Update actions and statuses of all order line items (set Suspend action)

Response Messages

Parameter Mandatory Type Default Description Example
code Yes String Operation execution result code 305
message Yes String Additional information Suspension order is successfully created
severity Yes String Operation execution result severity INFO, ERROR
orderId Yes String Id of the created order. If empty - an acception occured during execution 8014J000000PCD2QAO

Additional information about codes and messages:

Code Severity Message
305 INFO Suspension order is successfully created
208 ERROR accountId parameter is mandatory
208 ERROR requestDate parameter is mandatory
208 ERROR assets parameter is mandatory (should be concatenated list of asset Ids to suspend)
208 ERROR Unable to find a customer account with Id {accountId}
208 ERROR An error occurred while creating an asset-based order. Please check input parameters (assets)

Sample Request

POST  /services/apexrest/vlocity_cmt/v1/integrationprocedure/Otter_CPQCreateSuspendOrder
{
    "accountId": "0014J000003QMHB",
    "requestDate": "2019-12-01",
    "assets": "02i4J000000HQ83QAG,02i4J000000HQ83QAH,02i4J000000HQ83QAK"
}

Sample Response (Success)

{
  "code": "305",
  "message": "Suspension order is successfully created",
  "severity": "INFO",
  "orderId": "8014J000000PCD2QAO"
}

Sample Response (Error)

{
  "code": "208",
  "message": "Unable to find a customer account with Id 0014J000003QMHBa",
  "severity": "ERROR"
}