Get Time-Dependent Account Product List

Retrieves an array of products from the time-dependent account product list.

A time-dependent list is generated from the products that are included in the product assortment that’s been defined for the purpose. See Understand Account Product List.

Limits:

  • Maximum number of months based on TradeCalMaxNumberMonths. Default value is 18. See Soft Limits of Trade Calendar.
  • Maximum number of products in the time-dependent account product list based on TimeDepAccProdListResponseMaxProds. Default value is 30000.

Resource 

1GET_TIME_DEPENDENT_ACCOUNT_PRODUCT_LIST

Available version 

55.0

Request Parameters 

NameTypeDescriptionRequired or Optional
accountIdStringID of the account record from Salesforce.Required
validFromNumberThe date and time that specifies the beginning of the time period (in timestamp format).Required
validThruNumberThe date and time that specifies the end of the time period (in timestamp format).Required

Apex Request Example 

1// Logical endpoint name
2String endpointName = 'GET_TIME_DEPENDENT_ACCOUNT_PRODUCT_LIST';
3// name of the salesorg for which the hob should be scheduled
4String salesOrg = '0001';
5<namespace>.OffplatformCallout callout = new <namespace>.OffplatformCallout(endpointName, salesOrg);
6// Log Transaction Id
7String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
8// Account Id for which the products in the global apl should be retrieved
9Id accountId = '001B000001Q48yMIAR'; // Kroger Atlanta
10DateTime validFrom = DateTime.valueOfGmt('2022-01-01 00:00:00Z');
11DateTime validThru = DateTime.valueOfGmt('2022-12-31 00:00:00Z');
12Map<String, String> urlParameters = new Map<String,String>();
13urlParameters.put('accountsfid', accountId);
14urlParameters.put('validfrom', validFrom.getTime());
15urlParameters.put('validthru', validThru.getTime());
16String payload = null;
17<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload);
18if (response.status != 200) {
19   // Handle error and return error info to caller
20} 
21// Fetch the list from the response
22Set<Id> accountproducts = new Set<Id>();
23String aplListString = (String) response.Result;
24if (!String.isEmpty(aplListString)) {
25    Map<String, Object> mapAccountProductList = (Map<String, Object>) JSON.deserializeUntyped(
26        aplListString
27    );
28    List<Object> listAccountProductListIds = (List<Object>) mapAccountProductList.get(
29    'accountproducts'
30    );
31    for (Object obj : listAccountProductListIds) {
32        accountproducts.add((Id) obj);
33    }
34}