ccrz.ccApiPriceList.fetchPriceListItems

Executes a SOQL query of price list item records, and returns a list of price list item IDs.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

You can still call older versions of the API for this method, which can accept different input keys or return different output keys. Any differences in behavior for older versions aren't documented in this topic.

Note

Signature

global static Map<String, Object> fetchPriceListItems(Map<String, Object>)

Service Layer Classes

Logic Service Provider
ccrz.ccServicePL

Inputs (Required)

Map<String, Object> that must include the following required keys:

ccrz.ccApi.API_VERSION
The version of the B2B Commerce for Visualforce API to reference for the method call. We recommend that you use the ccrz.ccApi.CURRENT_VERSION constant whenever possible, and only reference a specific version for compatibility if necessary.

If this key isn't specified, the method returns a ccrz.ccApi.NoApiVersionException.

Note

Inputs (Optional)

The input map can also include the following keys:

ccrz.ccApiPriceList.CURRCODE
String that specifies an ISO 4217 currency code, such as USD or JPY.

If the input data doesn't include this key, the method falls back to ccrz.cc_CallContext.userCurrency.

Note

ccrz.ccApiPriceList.EFFACCTID
String that specifies the ID of an account record to filter price list items by. The method returns only the price list items for the price lists that are assigned to the specified account's account group.

If the input data doesn't include this key, the method falls back to ccrz.cc_CallContext.currAccountId.

Note

ccrz.ccApiPriceList.EFFDATEPLI
Date to filter price list items by. The method returns only the price list item records where the date is included in the Start Date and End Date range.

If the input data doesn't include this key, the method falls back to the current date.

Note

ccrz.ccApiPriceList.IDS
Set<String> of specific price list IDs whose items you want to return:
new Set<String>{'Price_List_ID_1', 'Price_List_ID_2'}
ccrz.ccApiPriceList.PLI_IDS
Set<String> of specific price list item IDs to query:
new Set<String>{'Price_List_Item_ID_1', 'Price_List_Item_ID_2'}
ccrz.ccApiPriceList.PLISERVSPLIT
Integer that specifies the maximum number of price list items that can pass through ccrz.ccService.transform at once.

The default value is 200. You can fine-tune performance of your price data queries by modifying this value.

Tip

ccrz.ccApiPriceList.PRODUCTIDS
Set<String> of specific IDs for the product records whose price list items you want to query.
new Set<String>{'Product_ID_1', 'Product_ID_2'}
ccrz.ccApiPriceList.PRODUCTSKUS
Set<String> of specific SKU values for the product records whose price list items you want to query.
new Set<String>{'Product_SKU_1', 'Product_SKU_2'}
ccrz.ccApiPriceList.NAME
String that specifies the name of a price list whose items you want to return.
ccrz.ccApiPriceList.STOREFRONT
String that specifies the name of a storefront for filtering the query.

If the input data doesn't include this key, the method falls back to ccrz.cc_CallContext.storefront.

Note

ccrz.ccApiPriceList.SUBPRODTERMS
Set<String> of specific subscription term IDs whose price list items you want to query.
new Set<String>{'SubProdTerm_ID_1', 'SubProdTerm_ID_2'}

Specify only one key from among ccrz.ccApiPriceList.IDS or ccrz.ccApiPriceList.EFFACCTID.

Important

Outputs

Map<String, Object> that can include the following keys:

ccrz.ccApi.API_VERSION
Integer that indicates which API version was used for the query.
ccrz.ccApi.SUCCESS
Boolean
Value Usage
true The call completed.
false The call encountered errors.

B2B Commerce for Visualforce doesn't always return an exception for any errors that can occur. When this value is false, consider rolling back the API transaction to a previous savepoint.

Tip

ccrz.ccApiPriceList.PRICELISTITEMS
Map<String, Map<String,Object>> keyed by the IDs of the returned price list items.

To specify which fields the API returns for each price list item, request a specific data size for the ccrz.ccApiPriceList.ENTITYNAME_PLI key in your input data:

ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiPriceList.ENTITYNAME_PLI => new Map<String, Object> {
        ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_L
    }
}

For information about which fields are available with different data sizes, see the ccrz__E_PriceListItem__c reference.

Tip

Example

For a set of specific product SKUs, fetch the price list items assigned to those products.

Map<String, Object> priceListItemsToFetch = new Map<String, Object> {
    ccrz.ccApi.API_VERSION => ccrz.ccApi.CURRENT_VERSION,
    ccrz.ccApiPriceList.PRODUCTSKUS => new Set<String>{'Product_SKU_1', 'Product_SKU_2'},
    ccrz.ccApi.SIZING => new Map<String, Object> {
        ccrz.ccApiPriceList.ENTITYNAME_PLI => new Map<String, Object> {
            ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_S
        }
    }
};

Map<String, Object> priceListItemsFetched = ccrz.ccApiPriceList.fetchPriceListItems(priceListItemsFetched);

System.debug('priceListItemsFetched KEYS=' + JSON.serializePretty(priceListItemsFetched.keySet()));
Boolean success = (Boolean)priceListItemsFetched.get(ccrz.ccApi.SUCCESS);

if(success) {
    Map<String, Map<String, Object>> priceListItems = (Map<String, Map<String, Object>>)priceListItemsFetched.get(ccrz.ccApiPriceList.PRICELISTITEMS);
    System.debug('pricelistitems=' + JSON.serializePretty(priceListItems));
} else {
    List<ccrz.cc_bean_Message> messages = (List<ccrz.cc_bean_Message>)priceListItemsFetched.get(ccrz.ccApi.MESSAGES);
    System.debug('messages=' + messages);
}