Newer Version Available

This content describes an older version of this product. View Latest

Get Global Account Product List

Retrieves the account products from the global account product list based on the volumes and measures for the customer for the account.
A product is included in a global list if one of these criteria is met.
  • Volume or condition record exists for the product.
  • The product is included in a promotion that's created for the customer.
See Understand Account Product List.
Resource
1GET_GLOBAL_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
Apex Request Example
1// Logical endpoint name
2String endpointName = 'GET_GLOBAL_ACCOUNT_PRODUCT_LIST';
3// name of the salesorg for which the API must 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
12
13Map<String, String> urlParameters = new Map<String,String>();
14urlParameters.put('accountid', accountId);
15
16String payload = null;
17
18<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload);
19
20if (response.status != 200) {
21   // Handle error and return error info to caller
22  
23} 
24// Fetch the list from the response
25Set<Id> accountproducts = new Set<Id>();
26String aplListString = (String) response.Result;
27if (!String.isEmpty(aplListString)) {
28    Map<String, Object> mapAccountProductList = (Map<String, Object>) JSON.deserializeUntyped(
29        aplListString
30    );
31    List<Object> listAccountProductListIds = (List<Object>) mapAccountProductList.get(
32    'accountproducts'
33    );
34    for (Object obj : listAccountProductListIds) {
35    accountproducts.add((Id) obj);
36    }
37}