Create Cart (assetToOrder)

Create orders from existing assets by performing move, add, change, and delete (MACD) actions. Use assetToOrder only for Future Dated Orders.

note: - The inputFields is not supported for AssetToOrder (subaction as assetToOrder).

  • This API supports following Date and DateTime formats.

    • yyyy-MM-dd
    • yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
    • yyyy-MM-dd'T'HH:mm:ss.SSSZ
    • yyyy-MM-dd'T'HH:mm:ss.SSSX
    • yyyy-MM-dd'T'HH:mm:ssXXX
    • yyyy-MM-dd'T'HH:mm:ss'Z'
    • yyyy-MM-dd HH:mm:ss
    • YYYY-MM-DDTHH:MM:SS.sss.000+0000

    Date format example:

    • 2025-06-01

    DateTime format examples:

    • 2026-01-24T11:13:33.000Z
    • 2026-01-24T11:13:33.000+0000
    • 2026-06-01T12:34:56.789Z
    • 2026-06-01T12:34:56+00:00
    • 2026-06-01T12:34:56Z
    • 2026-06-01 12:34:56
  • Standard Cart APIs parse these ISO date and date-time formats and do not use the running user's Salesforce locale. Classic Cart APIs parse date fields with locale-based Date.parse(), so values such as dd/mm/yyyy can succeed for day-first locales. Send ISO values (yyyy-MM-dd or yyyy-MM-dd'T'HH:mm:ss'Z') so the same payload works when Standard Cart APIs are enabled or disabled.

POST /v2/carts

Remote Method

assetToOrder

REST Handler

APICreateCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
"methodName":"assetToOrder",
"id":"02i3O000006PrKSQA0,02i3O000006PrKSQB0",
"accountId":"801360000008eNU",
"requestDateTime":"2021-10-07"
}

Apex Sample

  String methodName = 'assetToOrder';
  String assetId = '02iS80000040exdIAA';
  String accountId = '001du000002PciXAAS';
  String requestDateTime = '2025-06-06T07:19:14.174Z';
  Map<String, Object> inputMap = new Map<String, Object>();
  Map<String, Object> outputMap = new Map<String, Object>();
  Map<String, Object> optionsMap = new Map<String, Object>();
  inputMap.put('subaction', methodName);
  inputMap.put('id', assetId);
  inputMap.put('accountId', accountId);
  inputMap.put('requestDateTime',requestDateTime);
  vlocity_cmt.CpqAppHandler cpqAppHandlerService = new vlocity_cmt.CpqAppHandler();
  cpqAppHandlerService.invokeMethod(methodName, inputMap, outputMap, optionsMap);

Package

Communication (vlocity__cmt)

Resource Information

Resource URL: /services/apexrest/{namespace}/v2/carts Response Format: JSON

Example Request

While performing AssetToOrder we can create Order of specific RecordType by RecordTypeId in the request payload

{
    "subaction": "assetToOrder",
    "id": "02ixx0000004HROAA2",
    "inputFields": [ { "RecordTypeId": "012xx0000005pgzAAA" } ],
    "accountId": "001xx000003GfGdAAK",
    "requestDateTime": "2024-09-30 19:24:04"
}

To raise a Change Order on the current time and date:

{
"subaction":"assetToOrder",
"id":"02i3O000006PrKSQA0,02i3O000006PrKSQB0",
"accountId":"801360000008eNU",
"requestDateTime":"2021-10-07"
}

Example Response

{
"messages":[],
"records":[
  {
  "messages":[],
  "cartId":"801xx000003GfgxAAC",
  "displaySequence":-1
  }
  ],
  "totalSize":0
}