Newer Version Available
Get 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
-
Name Type Description Required or Optional accountId String ID of the account record from Salesforce. Required validFrom Number The date and time that specifies the beginning of the time period (in timestamp format). Required validThru Number The 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 7// Log Transaction Id 8String txId = <namespace>.TransactionHandler.getTransactionIdentifier(); 9 10// Account Id for which the products in the global apl should be retrieved 11Id accountId = '001B000001Q48yMIAR'; // Kroger Atlanta 12DateTime validFrom = DateTime.valueOfGmt('2022-01-01 00:00:00Z'); 13DateTime validThru = DateTime.valueOfGmt('2022-12-31 00:00:00Z'); 14 15Map<String, String> urlParameters = new Map<String,String>(); 16urlParameters.put('accountsfid', accountId); 17urlParameters.put('validfrom', validFrom.getTime()); 18urlParameters.put('validthru', validThru.getTime()); 19 20String payload = null; 21 22<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload); 23 24if (response.status != 200) { 25 // Handle error and return error info to caller 26 27} 28// Fetch the list from the response 29Set<Id> accountproducts = new Set<Id>(); 30String aplListString = (String) response.Result; 31if (!String.isEmpty(aplListString)) { 32 Map<String, Object> mapAccountProductList = (Map<String, Object>) JSON.deserializeUntyped( 33 aplListString 34 ); 35 List<Object> listAccountProductListIds = (List<Object>) mapAccountProductList.get( 36 'accountproducts' 37 ); 38 for (Object obj : listAccountProductListIds) { 39 accountproducts.add((Id) obj); 40 } 41}