Get Assets for Account

Retrieve the assets for a specified account ID.

1GET /v2/assets/{ID}/pricing?accountId={account_ID}

Remote Method 

1getAssetsByAccount

Handlers 

1REST Endpoint: APIAssetsContractsV2.cls
2Implementation: CpqAssetsContractsActionV2.cls

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1methodName: getAssetsByAccount
2accountId: 0011I000007lzDO
3includes: noContractAssets
4effectiveAssetsDateFilter: 2019-04-05T07:00:00.000Z
5pagesize: 2

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/accounts/{account_ID}/assets

Example Request 

1GET /services/apexrest/vlocity_cmt/v2/accounts/0011I000007lzDO/assets?pagesize=2&includes=noContractAssets&effectiveAssetsDateFilter=2019-04-05T07:00:00.000Z

To populate the attributeCategories node in the response for getAsset API, provide one of the two fields Product2.AttributeMetadatac or JSONAttributec as an input.

If V2AttributeModel is enabled, then provide Product2.AttributeMetadatac. If V2AttributeModel is disabled, then pass JSONAttributec.

1GET
2/services/apexrest/vlocity_cmt/v2/accounts/{accountId}/assets?fields=vlocity_cmt**JSONAttribute**c

From Spring’25, the Get Assets for Account API applies the timeOffset in the effectiveAssetsDateFilte. If no offset is provided, it defaults to 00:00:00. To resolve this, append the time to the effectiveAssetsDateFilter parameter. Customers can set up a pre-hook to apply this adjustment automatically.

Pre-hook for getAssetsByAccount 

The CPQ APIs allow you to write custom pre and post hooks for each API to implement custom logic. The pre-hook runs before the API executes, while the post-hook runs after the API executes.

  1. Write the custom class to implement the pre and post hook.

    Here’s the sample code that appends the timeoffset to the effectiveAssetsDateFilter when only a date is provided.

1global with sharing class CPQCustomHookImplementation implements vlocity_cmt.VlocityOpenInterface{
2global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
3
4    if( methodName.equalsIgnoreCase('getAssetsByAccount.PreInvoke')) {
5         getAssetsByAccount_PreInvoke(methodName, input, output,options);
6         return true;
7    }
8
9    return false;
10
11}
12
13private void getAssetsByAccount_PreInvoke(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
14   //This method gets called before getAssetsByAccount
15   String dateStr = (String)input.get('effectiveAssetsDateFilter');
16    if(dateStr.length() == 10){
17         dateStr = dateStr+'T23:59:59.000Z';
18         input.put('effectiveAssetsDateFilter',dateStr);
19   }
20}
21}
  1. Create the interface implementation. For example: Interface Name = CpqAppHandlerHookInterface Implementation = CPQCustomHookImplementation

Example Response 

1{
2 "totalSize": 1,
3 "messages": [],
4 "records": [{
5  "messages": [],
6  "actions": {
7   "assetchangesite": {
8    "rest": {
9     "params": {},
10     "method": "POST",
11     "link": "/services/apexrest/vlocity_cmt/v2/carts?subaction=assetChangeSite"
12    },
13    "remote": {
14     "params": {
15      "assetList": ["02i1I00000058doQAA"],
16      "moveDate": null,
17      "toServiceLocation": null,
18      "fromServiceLocation": null
19     }
20    },
21    "client": {
22     "params": {}
23    }
24   },
25   "assettoquote": {
26    "rest": {
27     "params": {},
28     "method": "POST",
29     "link": "/services/apexrest/vlocity_cmt/v2/carts?subaction=assetToQuote"
30    },
31    "remote": {
32     "params": {
33      "assetList": ["02i1I00000058doQAA"],
34      "requestDate": null
35     }
36    },
37    "client": {
38     "params": {}
39    }
40   },
41   "assettoorder": {
42    "rest": {
43     "params": {},
44     "method": "POST",
45     "link": "/services/apexrest/vlocity_cmt/v2/carts?subaction=assetToOrder"
46    },
47    "remote": {
48     "params": {
49      "assetList": ["02i1I00000058doQAA"],
50      "requestDate": null
51     }
52    },
53    "client": {
54     "params": {}
55    }
56   }
57  },
58  "displaySequence": -1,
59  "Id": {
60   "value": "02i1I00000058doQAA",
61   "previousValue": null,
62   "originalValue": null,
63   "messages": [],
64   "label": "Asset ID",
65   "hidden": true,
66   "fieldName": "Id",
67   "editable": false,
68   "dataType": "ID",
69   "actions": {}
70  },
71  "Quantity": {
72   "value": 1.00,
73   "previousValue": null,
74   "originalValue": null,
75   "messages": [],
76   "label": "Quantity",
77   "hidden": true,
78   "fieldName": "Quantity",
79   "editable": false,
80   "dataType": "DOUBLE",
81   "actions": {}
82  },
83  "vlocity_cmt__ProvisioningStatus__c": {
84   "value": "Active",
85   "previousValue": null,
86   "originalValue": null,
87   "messages": [],
88   "label": "Provisioning Status",
89   "hidden": true,
90   "fieldName": "vlocity_cmt__ProvisioningStatus__c",
91   "editable": false,
92   "dataType": "STRING",
93   "actions": {}
94  },
95  "vlocity_cmt__RecurringTotal__c": {
96   "value": 10.00,
97   "previousValue": null,
98   "originalValue": null,
99   "messages": [],
100   "label": "Recurring Total",
101   "hidden": true,
102   "fieldName": "vlocity_cmt__RecurringTotal__c",
103   "editable": false,
104   "dataType": "CURRENCY",
105   "actions": {
106    "pricedetail": {
107     "rest": {
108      "params": {},
109      "method": "GET",
110      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
111
112     },
113     "remote": {
114      "params": {
115       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
116       "priceDetailsFields": "vlocity_cmt__RecurringTotal__c",
117       "priceDetail": true,
118       "id": "02i1I00000058doQAA",
119       "accountId": "0011I000007ms8TQAQ",
120       "methodName": "getAssetPriceDetail"
121      }
122     },
123     "client": {
124      "records": [],
125      "params": {}
126     }
127    }
128   }
129  },
130  "vlocity_cmt__OneTimeTotal__c": {
131   "value": 100.00,
132   "previousValue": null,
133   "originalValue": null,
134   "messages": [],
135   "label": "One Time Total",
136   "hidden": true,
137   "fieldName": "vlocity_cmt__OneTimeTotal__c",
138   "editable": false,
139   "dataType": "CURRENCY",
140   "actions": {
141    "pricedetail": {
142     "rest": {
143      "params": {},
144      "method": "GET",
145      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
146
147     },
148     "remote": {
149      "params": {
150       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
151       "priceDetailsFields": "vlocity_cmt__OneTimeTotal__c",
152       "priceDetail": true,
153       "id": "02i1I00000058doQAA",
154       "accountId": "0011I000007ms8TQAQ",
155       "methodName": "getAssetPriceDetail"
156      }
157     },
158     "client": {
159      "records": [],
160      "params": {}
161     }
162    }
163   }
164  },
165  "vlocity_cmt__ContractId__c": {
166   "value": "8001I0000000ThqQAE",
167   "previousValue": null,
168   "originalValue": null,
169   "messages": [],
170   "label": "Contract",
171   "hidden": false,
172   "fieldName": "vlocity_cmt__ContractId__c",
173   "editable": false,
174   "dataType": "REFERENCE",
175   "actions": {}
176  },
177  "vlocity_cmt__LineNumber__c": {
178   "value": "0001",
179   "previousValue": null,
180   "originalValue": null,
181   "messages": [],
182   "label": "Line Number",
183   "hidden": true,
184   "fieldName": "vlocity_cmt__LineNumber__c",
185   "editable": false,
186   "dataType": "STRING",
187   "actions": {}
188  },
189  "vlocity_cmt__RootItemId__c": {
190   "value": "02i1I00000058doQAA",
191   "previousValue": null,
192   "originalValue": null,
193   "messages": [],
194   "label": "RootItemId",
195   "hidden": true,
196   "fieldName": "vlocity_cmt__RootItemId__c",
197   "editable": false,
198   "dataType": "STRING",
199   "actions": {}
200  },
201  "vlocity_cmt__OneTimeCharge__c": {
202   "value": 100.00,
203   "previousValue": null,
204   "originalValue": null,
205   "messages": [],
206   "label": "One Time Charge",
207   "hidden": true,
208   "fieldName": "vlocity_cmt__OneTimeCharge__c",
209   "editable": false,
210   "dataType": "CURRENCY",
211   "actions": {
212    "pricedetail": {
213     "rest": {
214      "params": {},
215      "method": "GET",
216      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
217
218     },
219     "remote": {
220      "params": {
221       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
222       "priceDetailsFields": "vlocity_cmt__OneTimeCharge__c",
223       "priceDetail": true,
224       "id": "02i1I00000058doQAA",
225       "accountId": "0011I000007ms8TQAQ",
226       "methodName": "getAssetPriceDetail"
227      }
228     },
229     "client": {
230      "records": [],
231      "params": {}
232     }
233    }
234   }
235  },
236  "vlocity_cmt__OneTimeCalculatedPrice__c": {
237   "value": 100.00,
238   "previousValue": null,
239   "originalValue": null,
240   "messages": [],
241   "label": "One Time Calculated Price",
242   "hidden": true,
243   "fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
244   "editable": false,
245   "dataType": "CURRENCY",
246   "actions": {
247    "pricedetail": {
248     "rest": {
249      "params": {},
250      "method": "GET",
251      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
252
253     },
254     "remote": {
255      "params": {
256       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
257       "priceDetailsFields": "vlocity_cmt__OneTimeCalculatedPrice__c",
258       "priceDetail": true,
259       "id": "02i1I00000058doQAA",
260       "accountId": "0011I000007ms8TQAQ",
261       "methodName": "getAssetPriceDetail"
262      }
263     },
264     "client": {
265      "records": [],
266      "params": {}
267     }
268    }
269   }
270  },
271  "vlocity_cmt__OneTimeManualDiscount__c": {
272   "value": 0.00,
273   "previousValue": null,
274   "originalValue": null,
275   "messages": [],
276   "label": "One Time Manual Discount",
277   "hidden": true,
278   "fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
279   "editable": false,
280   "dataType": "PERCENT",
281   "actions": {}
282  },
283  "vlocity_cmt__RecurringCharge__c": {
284   "value": 10.00,
285   "previousValue": null,
286   "originalValue": null,
287   "messages": [],
288   "label": "Recurring Charge",
289   "hidden": true,
290   "fieldName": "vlocity_cmt__RecurringCharge__c",
291   "editable": false,
292   "dataType": "CURRENCY",
293   "actions": {
294    "pricedetail": {
295     "rest": {
296      "params": {},
297      "method": "GET",
298      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
299
300     },
301     "remote": {
302      "params": {
303       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
304       "priceDetailsFields": "vlocity_cmt__RecurringCharge__c",
305       "priceDetail": true,
306       "id": "02i1I00000058doQAA",
307       "accountId": "0011I000007ms8TQAQ",
308       "methodName": "getAssetPriceDetail"
309      }
310     },
311     "client": {
312      "records": [],
313      "params": {}
314     }
315    }
316   }
317  },
318  "vlocity_cmt__RecurringCalculatedPrice__c": {
319   "value": 10.00,
320   "previousValue": null,
321   "originalValue": null,
322   "messages": [],
323   "label": "Recurring Calculated Price",
324   "hidden": true,
325   "fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
326   "editable": false,
327   "dataType": "CURRENCY",
328   "actions": {
329    "pricedetail": {
330     "rest": {
331      "params": {},
332      "method": "GET",
333      link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02 i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ & priceDetailsFields = vlocity_cmt__RecurringTotal__c & effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "
334
335     },
336     "remote": {
337      "params": {
338       "effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
339       "priceDetailsFields": "vlocity_cmt__RecurringCalculatedPrice__c",
340       "priceDetail": true,
341       "id": "02i1I00000058doQAA",
342       "accountId": "0011I000007ms8TQAQ",
343       "methodName": "getAssetPriceDetail"
344      }
345     },
346     "client": {
347      "records": [],
348      "params": {}
349     }
350    }
351   }
352  },
353  "vlocity_cmt__RecurringManualDiscount__c": {
354   "value": 0.00,
355   "previousValue": null,
356   "originalValue": null,
357   "messages": [],
358   "label": "Recurring Manual Discount",
359   "hidden": true,
360   "fieldName": "vlocity_cmt__RecurringManualDiscount__c",
361   "editable": false,
362   "dataType": "PERCENT",
363   "actions": {}
364  },
365  "vlocity_cmt__ServiceAccountId__c": {
366   "value": "0011I000007ms8TQAQ",
367   "previousValue": null,
368   "originalValue": null,
369   "messages": [],
370   "label": "Service Account",
371   "hidden": false,
372   "fieldName": "vlocity_cmt__ServiceAccountId__c",
373   "editable": false,
374   "dataType": "REFERENCE",
375   "actions": {}
376  },
377  "vlocity_cmt__BillingAccountId__c": {
378   "value": "0011I000007ms8TQAQ",
379   "previousValue": null,
380   "originalValue": null,
381   "messages": [],
382   "label": "Billing Account",
383   "hidden": false,
384   "fieldName": "vlocity_cmt__BillingAccountId__c",
385   "editable": false,
386   "dataType": "REFERENCE",
387   "actions": {}
388  },
389  "vlocity_cmt__PricingLogData__c": {
390   "value": "{\"LogData\":{\"OT_STD_PRC\":[{\"PriceListEntryId\":\"a2X1I0000009iFXUAY\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey\":\"775e358f-31c4-e8de-e23d-e00bbbfedfa6\",\"StartValue\":100.00,\"SubType\":\"Standard\",\"Frequency\":null,\"ChargeTiming\":\"One-time\",\"EndValue\":100.00,\"DisplayText\":\"100$ OTSP\",\"PricingVariableCode\":\"OT_STD_PRC\",\"PricingElementId\":\"a2a1I000000Bar6QAC\",\"PromotionId\":null,\"OfferId\":null,\"PriceListId\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment\":null,\"BaseValue\":100.00,\"AdjustmentMethod\":null,\"AdjustmentValue\":0.00,\"Amount\":100.00,\"AdjustmentType\":\"None\",\"LogSequence\":0}],\"REC_MNTH_STD_PRC\":[{\"PriceListEntryId\":\"a2X1I0000009iFcUAI\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey\":\"9ef41d53-1bba-017e-625a-b06ac2de2c28\",\"StartValue\":10.00,\"SubType\":\"Standard\",\"Frequency\":\"Monthly\",\"ChargeTiming\":\"Recurring\",\"EndValue\":10.00,\"DisplayText\":\"10$ RMSP\",\"PricingVariableCode\":\"REC_MNTH_STD_PRC\",\"PricingElementId\":\"a2a1I000000Bar1QAC\",\"PromotionId\":null,\"OfferId\":null,\"PriceListId\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment\":null,\"BaseValue\":10.00,\"AdjustmentMethod\":null,\"AdjustmentValue\":0.00,\"Amount\":10.00,\"AdjustmentType\":\"None\",\"LogSequence\":0}],\"OT_STD_PRC_CALC\":[{\"LogSequence\":0,\"DisplayText\":\"One Time Charge (100.00) - One Time Manual Discount (0.00%)\"}],\"OT_STD_PRC_TOTAL\":[{\"LogSequence\":0,\"DisplayText\":\"[One Time Calculated Price (100.00) + Rollup One Time Total (0.00)] x Quantity (1.00)\"}],\"REC_MNTH_STD_PRC_CALC\":[{\"LogSequence\":0,\"DisplayText\":\"Recurring Charge (10.00) - Recurring Manual Discount (0.00%)\"}],\"REC_MNTH_STD_PRC_TOTAL\":[{\"LogSequence\":0,\"DisplayText\":\"[Recurring Calculated Price (10.00) + Rollup Recurring Total (0.00)] x Quantity (1.00)\"}]},\"PricingVariableCodeFieldBinding\":{\"Quantity\":\"LINE_QUANTITY\",\"vlocity_cmt__EffectiveRecurringTotal__c\":\"EFF_REC_MNTH_STD_PRC_TOTAL\",\"vlocity_cmt__EffectiveOneTimeTotal__c\":\"EFF_OT_STD_PRC_TOTAL\",\"vlocity_cmt__OneTimeCalculatedPrice__c\":\"OT_STD_PRC_CALC\",\"vlocity_cmt__OneTimeManualDiscount__c\":\"OT_STD_PRC_DISC_PCT_MAN\",\"vlocity_cmt__OneTimeCharge__c\":\"OT_STD_PRC\",\"vlocity_cmt__RecurringTotal__c\":\"REC_MNTH_STD_PRC_TOTAL\",\"vlocity_cmt__RecurringCalculatedPrice__c\":\"REC_MNTH_STD_PRC_CALC\",\"vlocity_cmt__RecurringManualDiscount__c\":\"REC_MNTH_STD_PRC_DISC_PCT_MAN\",\"vlocity_cmt__RecurringCharge__c\":\"REC_MNTH_STD_PRC\",\"vlocity_cmt__OneTimeTotal__c\":\"OT_STD_PRC_TOTAL\",\"vlocity_cmt__EffectiveQuantity__c\":\"EFFECTIVE_QUANTITY\"},\"PriceAdjustmentPromoKeys\":[],\"PricingVariableCodeValues\":{\"LINE_QUANTITY\":1.00,\"OT_STD_PRC_DISC_PCT_MAN\":0.00,\"REC_MNTH_STD_PRC_DISC_PCT_MAN\":0.00,\"OT_STD_PRC\":100.00,\"OT_STD_PRC_CALC\":100.00,\"OT_STD_PRC_TOTAL\":100.00,\"REC_MNTH_STD_PRC\":10.00,\"REC_MNTH_STD_PRC_CALC\":10.00,\"REC_MNTH_STD_PRC_TOTAL\":10.00,\"ROLLUP_OT_STD_PRC_TOTAL\":0.00,\"ROLLUP_REC_MNTH_STD_PRC_TOTAL\":0.00,\"EFF_OT_STD_PRC_TOTAL\":100.00,\"EFF_REC_MNTH_STD_PRC_TOTAL\":10.00,\"EFFECTIVE_QUANTITY\":1.00},\"PricingVariableCodeBaseValues\":{\"OT_STD_PRC\":100.00,\"REC_MNTH_STD_PRC\":10.00},\"LogVersion\":\"1.0\",\"LastPricingTime\":\"2019-11-07T10:21:55.572Z\"}",
391   "previousValue": null,
392   "originalValue": null,
393   "messages": [],
394   "label": "Pricing Log",
395   "hidden": true,
396   "fieldName": "vlocity_cmt__PricingLogData__c",
397   "editable": false,
398   "dataType": "TEXTAREA",
399   "actions": {}
400  },
401  "vlocity_cmt__SequenceNumber__c": {
402   "value": 1,
403   "previousValue": null,
404   "originalValue": null,
405   "messages": [],
406   "label": "Sequence Number",
407   "hidden": true,
408   "fieldName": "vlocity_cmt__SequenceNumber__c",
409   "editable": false,
410   "dataType": "DOUBLE",
411   "actions": {}
412  },
413  "vlocity_cmt__PricebookEntryId__c": {
414   "value": "01u1I000000ZY4nQAG",
415   "previousValue": null,
416   "originalValue": null,
417   "messages": [],
418   "label": "PricebookEntryId",
419   "hidden": true,
420   "fieldName": "vlocity_cmt__PricebookEntryId__c",
421   "editable": false,
422   "dataType": "STRING",
423   "actions": {}
424  },
425  "vlocity_cmt__EffectiveQuantity__c": {
426   "value": 1.00,
427   "previousValue": null,
428   "originalValue": null,
429   "messages": [],
430   "label": "Effective Quantity",
431   "hidden": true,
432   "fieldName": "vlocity_cmt__EffectiveQuantity__c",
433   "editable": false,
434   "dataType": "DOUBLE",
435   "actions": {}
436  },
437  "vlocity_cmt__EffectiveRecurringTotal__c": {
438   "value": 10.00,
439   "previousValue": null,
440   "originalValue": null,
441   "messages": [],
442   "label": "Effective Recurring Total",
443   "hidden": true,
444   "fieldName": "vlocity_cmt__EffectiveRecurringTotal__c",
445   "editable": false,
446   "dataType": "CURRENCY",
447   "actions": {}
448  },
449  "vlocity_cmt__EffectiveOneTimeTotal__c": {
450   "value": 100.00,
451   "previousValue": null,
452   "originalValue": null,
453   "messages": [],
454   "label": "Effective One Time Total",
455   "hidden": true,
456   "fieldName": "vlocity_cmt__EffectiveOneTimeTotal__c",
457   "editable": false,
458   "dataType": "CURRENCY",
459   "actions": {}
460  },
461  "Name": "TestA",
462  "promotions": {
463   "totalSize": 0,
464   "messages": []
465  }
466 }]
467}