Multi-Transaction Service

The Multi-Transaction Service (MTS) is integrated with the Digital Commerce Basket APIs to split Apex transactions into multiple transactions to avoid exceeding Salesforce Governor limits. Use its configuration settings to enable it:

The MTS supports long-running transactions and returns a multiTransactionKey in the nexttransaction action. To proceed, call the API again with the multitransactionKey in the request payload as shown in the following example Add to Basket requests and responses with MTSEnabled set to true (the default).

Example Requests and Responses

Example Add to Basket Request

1POST
2/services/apexrest/{namespace}/v3/catalogs/{catalog_code}/basket?contextKey=017d3c3f990567a3ce2ca3e60262ec90&context={"accountId":"0019P000024jKuZ"}&isloggedin=true
3
4Body
5{
6  "offer": "TelcoResidential",
7  "basketAction": "AddWithNoConfig"
8}

Example Intermediate Response

1{
2  "nexttransaction": {
3    "rest": {
4      "params": {
5        "multiTransactionKey": "3d719d4a3b14cea4187ea9a5332cff0e",
6        "method": "addWithNoConfig"
7     }
8    }
9  }
10}

Example Request to Pass the multiTransactionKey

1POST 
2/services/apexrest/{namespace}/v3/catalogs/{catalog_code}/basket?contextKey=017d3c3f990567a3ce2ca3e60262ec90&context={"accountId":"0019P000024jKuZ"}&isloggedin=true
3
4Body
5{
6  "offer": "TelcoResidential",
7  "basketAction": "AddWithNoConfig",
8  "multiTransactionKey": "3d719d4a3b14cea4187ea9a5332cff0e"
9}

Example Response

This example is truncated.

1{
2  "cartContextKey": "20933d86217050b8d3b15654aeceae30",
3  "result": {
4    "totals": {
5      "EffectiveOneTimeTotal__c": 400,
6      "EffectiveRecurringTotal__c": 200
7    },
8    "totalSize": 1,
9    "records": [
10      {
11        "actions": {
12          "deleteFromBasketAction": {
13            "rest": {
14              "params": {
15                "basketAction": "deleteFromBasket",
16                "lineItemKey": "533befb7d15a0a400f09c59ecaef21ee",
17                "bundleContextKey": "533befb7d15a0a400f09c59ecaef21ee"
18              },
19              "link": "/v3/catalogs/vlocity_cmt/basket/20933d86217050b8d3b15654aeceae30?contextKey=017d3c3f990567a3ce2ca3e60262ec90&isloggedin=true",
20              "method": "deleteFromBasketAction"
21            }
22          },
23          "updateBasketAction": {
24            "rest": {
25              "params": {
26                "basketAction": "updateBasket",
27                "lineItemKey": "533befb7d15a0a400f09c59ecaef21ee",
28                "bundleContextKey": "533befb7d15a0a400f09c59ecaef21ee"
29              },
30              "link": "/v3/catalogs/{catalog_code}/basket/20933d86217050b8d3b15654aeceae30?contextKey=017d3c3f990567a3ce2ca3e60262ec90&isloggedin=true",
31              "method": "updateBasketAction"
32            }
33          }
34        },
35        "lineItemKey": "533befb7d15a0a400f09c59ecaef21ee",
36        "bundleContextKey": "533befb7d15a0a400f09c59ecaef21ee",
37        "displaySequence": -1,
38        "Id": {
39          "value": "8024P000001gdBNQAY",
40          "previousValue": null,
41          "originalValue": null,
42          "messages": [],
43          "label": "Order Product ID",
44          "hidden": false,
45          "fieldName": "Id",
46          "editable": false,
47          "dataType": "ID",
48          "alternateValues": null,
49          "actions": {}
50        },
51        "Pricebook2Id": "01s4P000002BoBuQAK",
52        "Product2Id": "01t4P000007VDOkQAO",
53        "ProductCode": "TelcoResidential",
54        "UnitPrice": {
55          "value": 0,
56          "previousValue": null,
57          "originalValue": null,
58          "messages": [],
59          "label": "Unit Price",
60          "hidden": true,
61          "fieldName": "UnitPrice",
62          "editable": false,
63          "dataType": "CURRENCY",
64          "alternateValues": null,
65          "actions": {}
66        },
67        "Name": "Telco Residential",
68        "IsActive": true,
69        "vlocity_cmt__RecurringPrice__c": 200,
70        "Product2": {
71          "attributes": {
72            "type": "Product2",
73            "url": "/services/data/v46.0/sobjects/Product2/01t4P000007VDOkQAO"
74          },
75          "Id": "01t4P000007VDOkQAO",
76          "Name": "Telco Residential",
77          "vlocity_cmt__IsConfigurable__c": false,
78          "vlocity_cmt__Type__c": "None",
79          "vlocity_cmt__SubType__c": "None",
80          "vlocity_cmt__SellingStartDate__c": "2019-05-01T18:00:00.000+0000",
81          "vlocity_cmt__SellingEndDate__c": "2019-09-30T18:00:00.000+0000",
82          "vlocity_cmt__JSONAttribute__c": null
83        },
84        "CurrencyCode": "USD",
85        "productId": "01t4P000007VDOkQAO",
86        "defaultQuantity": 1,
87        "minQuantity": 0,
88        "maxQuantity": 99999,
89        "groupMinQuantity": 0,
90        "groupMaxQuantity": 99999,
91        "sequenceNumber": 1,
92        "productChildItemDefinition": {
93          "attributes": {
94            "type": "vlocity_cmt__ProductChildItem__c"
95          },
96          "Name": "Root PCI",
97          "vlocity_cmt__IsVirtualItem__c": false,
98          "vlocity_cmt__Quantity__c": 1,
99          "vlocity_cmt__MaxQuantity__c": 99999,
100          "vlocity_cmt__MinQuantity__c": 0,
101          "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
102          "vlocity_cmt__MinimumChildItemQuantity__c": 0,
103          "vlocity_cmt__IsOverride__c": false,
104          "vlocity_cmt__ParentProductId__c": "01t4P000007VDOkQAO",
105          "vlocity_cmt__ChildLineNumber__c": "1",
106          "vlocity_cmt__SeqNumber__c": 1,
107          "vlocity_cmt__CollapseHierarchy__c": false,
108          "vlocity_cmt__IsRootProductChildItem__c": true,
109          "vlocity_cmt__ParentProductId__r": {
110            "attributes": {
111              "type": "Product2",
112              "url": "/services/data/v46.0/sobjects/Product2/01t4P000007VDOkQAO"
113            },
114            "Id": "01t4P000007VDOkQAO",
115            "Name": "Telco Residential",
116            "vlocity_cmt__SellingStartDate__c": "2019-05-01T18:00:00.000+0000",
117            "vlocity_cmt__SellingEndDate__c": "2019-09-30T18:00:00.000+0000"
118          }
119        },
120        "productHierarchyPath": "01t4P000007VDOkQAO",
121        "name": "Telco Residential",
122        "isVirtualItem": false,
123        "lineNumber": "0001",
124        "action": "Add",
125        "hasChildren": true,
126        "SellingPeriod": "Present",
127        "itemType": "lineItem",
128        "PricebookEntryId": {
129          "value": "01u4P00000s2eZjQAI",
130          "previousValue": null,
131          "originalValue": null,
132          "messages": [],
133          "label": "Price Book Entry ID",
134          "hidden": false,
135          "fieldName": "PricebookEntryId",
136          "editable": false,
137          "dataType": "REFERENCE",
138          "alternateValues": null,
139          "actions": {}
140        },
141        "Quantity": {
142          "value": 1,
143          "previousValue": null,
144          "originalValue": null,
145          "messages": [],
146          "label": "Quantity",
147          "hidden": false,
148          "fieldName": "Quantity",
149          "editable": true,
150          "dataType": "DOUBLE",
151          "alternateValues": null,
152          "actions": {}
153        },
154        "vlocity_cmt__OneTimeTotal__c": {
155          "value": 400,
156          "previousValue": null,
157          "originalValue": null,
158          "messages": [],
159          "label": "One Time Total",
160          "hidden": false,
161          "fieldName": "vlocity_cmt__OneTimeTotal__c",
162          "editable": false,
163          "dataType": "CURRENCY",
164          "alternateValues": null,
165          "actions": {
166            "adjustmentcodes": {
167              "rest": {
168                "params": {},
169                "method": "GET",
170                "link": "/services/apexrest/vlocity_cmt/v2/listsofvalues?listkeys=AdjustmentCodes&cartId=8014P0000022G0jQAE&id=8024P000001gdBNQAY&fields=vlocity_cmt__OneTimeTotal__c&PricingVariableCode=OT_STD_PRC_TOTAL"
171              },
172              "remote": {
173                "params": {}
174              },
175              "client": {
176                "records": [],
177                "params": {}
178              }
179            },
180            "pricedetail": {
181              "rest": {
182                "params": {},
183                "method": "GET",
184                "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8014P0000022G0jQAE/items/8024P000001gdBNQAY/pricing?cartId=8014P0000022G0jQAE&id=8024P000001gdBNQAY&fields=vlocity_cmt__OneTimeTotal__c"
185              },
186              "remote": {
187                "params": {}
188              },
189              "client": {
190                "records": [],
191                "params": {}
192              }
193            }
194          }
195
196        ...
197
198        }
199      }
200    ]
201  },
202  "createCartAction": {
203    "rest": {
204      "params": {
205        "cartContextKey": "20933d86217050b8d3b15654aeceae30"
206      },
207      "link": "/v3/carts",
208      "method": "createCartAction"
209    }
210  },
211  "errorCode": "INVOKE-200",
212  "error": "OK"
213}