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.

Resource 

1GET_GLOBAL_ACCOUNT_PRODUCT_LIST

Available version 

55.0

Request Parameters 

NameTypeDescriptionRequired or Optional
accountIdStringID 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// 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
10Map<String, String> urlParameters = new Map<String,String>();
11urlParameters.put('accountid', accountId);
12String payload = null;
13<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload);
14if (response.status != 200) {
15   // Handle error and return error info to caller
16} 
17// Fetch the list from the response
18Set<Id> accountproducts = new Set<Id>();
19String aplListString = (String) response.Result;
20if (!String.isEmpty(aplListString)) {
21    Map<String, Object> mapAccountProductList = (Map<String, Object>) JSON.deserializeUntyped(
22        aplListString
23    );
24    List<Object> listAccountProductListIds = (List<Object>) mapAccountProductList.get(
25    'accountproducts'
26    );
27    for (Object obj : listAccountProductListIds) {
28    accountproducts.add((Id) obj);
29    }
30}