ccrz.ccApiRelatedProduct.fetch

Executes a SOQL query of related product records and returns a list of records that match your query.

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> fetch(Map<String, Object>)

Service Layer Classes

Data Service Provider
ccrz.ccServiceRelatedProduct

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.ccApi.API_SIZING
Map<String, Object> that specifies the scope of data that this method returns, including which fields the method returns for each record that matches the query.
ccrz.ccApiRelatedProduct.PARAM_BY_ASC
Boolean
Value Usage
true Sort returned related product records by Sequence value in ascending order. For example, sort from 100 to 900.
false (default) Sort returned products by Sequence in descending order. For example, sort from 900 to 100.
ccrz.ccApiRelatedProduct.PARAM_BY_NULLS_LAST
Boolean
Value Usage
true Place all related product records with a null Sequence value at the end of the returned related product data.
false (default) Place all related product records with a null Sequence value at the beginning of the returned related product data.
ccrz.ccApiRelatedProduct.PRODUCTID
String that specifies a product ID whose related products you want to query.
ccrz.ccApiRelatedProduct.PRODUCTIDLIST
Set<String> of specific product IDs whose related products you want to query.
new Set<String>{'Product_ID_1', 'Product_ID_2'}
ccrz.ccApiRelatedProduct.RELATED_TYPE
Set<String> of specific Related Product Type field values you want to filter by.
new Set<String>{'Accessories', 'UpSell'}
ccrz.ccApiRelatedProduct.RELATEDPRODUCTID
String that specifies a related product record's ID.
ccrz.ccApiRelatedProduct.RELATEDPRODUCTIDLIST
Set<String> of specific related product record IDs to query.
new Set<String>{'Related_Product_ID_1', 'Related_Product_ID_2'}

This method evaluates the ID keys in the following order of precedence:

  1. ccrz.ccApiRelatedProduct.RELATEDPRODUCTID
  2. ccrz.ccApiRelatedProduct.RELATEDPRODUCTIDLIST
  3. ccrz.ccApiRelatedProduct.PRODUCTID
  4. ccrz.ccApiRelatedProduct.PRODUCTIDLIST

Note

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.ccApiRelatedProduct.RELATEDPRODUCTLIST
List<Map<String, Object>>, where each Map<String, Object> represents a related product record.
ccrz.ccApiProduct.PRODUCTLIST
List<Map<String, Object>>, where each Map<String, Object> represents a product record referenced from one of the related product records included in ccrz.ccApiRelatedProduct.RELATEDPRODUCTLIST.