---
schema_version: "1"
id: eebb6f7725006b323e1b26951d0798467cd96523739d0688a69a22372eef2e1b
title: Get Time-Dependent Account Product List
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/cgtpm_get_time_dependent_account_prod_list.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_get_time_dependent_account_prod_list.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2b7563fc2347228f7ddf1c2446b420a7475d9b610fa4bf23ec296f109e7d2107
description: Retrieves an array of products from the time-dependent account product list.
---
# 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](https://help.salesforce.com/s/articleView?id=ind.tpm_admin_concept_account_product_list.htm&type=5&language=en_US "HTML (New Window)").

Limits:

- Maximum number of months based on TradeCalMaxNumberMonths. Default value is 18. See [Soft Limits of Trade Calendar](https://help.salesforce.com/s/articleView?id=ind.tpm_reference_trade_calender_soft_limits.htm&type=5&language=en_US "HTML (New Window)").
- Maximum number of products in the time-dependent account product list based on TimeDepAccProdListResponseMaxProds. Default value is 30000.

## Resource

GET\_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

// Logical endpoint name
String endpointName = 'GET\_TIME\_DEPENDENT\_ACCOUNT\_PRODUCT\_LIST';
// name of the salesorg for which the hob should be scheduled
String salesOrg = '0001';
<namespace>.OffplatformCallout callout = new <namespace>.OffplatformCallout(endpointName, salesOrg);
// Log Transaction Id
String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
// Account Id for which the products in the global apl should be retrieved
Id accountId = '001B000001Q48yMIAR'; // Kroger Atlanta
DateTime validFrom = DateTime.valueOfGmt('2022-01-01 00:00:00Z');
DateTime validThru = DateTime.valueOfGmt('2022-12-31 00:00:00Z');
Map<String, String\> urlParameters = new Map<String,String\>();
urlParameters.put('accountsfid', accountId);
urlParameters.put('validfrom', validFrom.getTime());
urlParameters.put('validthru', validThru.getTime());
String payload = null;
<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload);
if (response.status != 200) {
   // Handle error and return error info to caller
} 
// Fetch the list from the response
Set<Id> accountproducts = new Set<Id>();
String aplListString = (String) response.Result;
if (!String.isEmpty(aplListString)) {
    Map<String, Object\> mapAccountProductList = (Map<String, Object\>) JSON.deserializeUntyped(
        aplListString
    );
    List<Object\> listAccountProductListIds = (List<Object\>) mapAccountProductList.get(
    'accountproducts'
    );
    for (Object obj : listAccountProductListIds) {
        accountproducts.add((Id) obj);
    }
}