Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

ccrz.ccApiSpec.fetchProductSpecIndices

Executes a SOQL query of product spec index records, which define a single instance of a spec value for a product.

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

Service Layer Classes

Data Service Provider
ccrz.ccServiceProductSpecIndex

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. To specify which fields are available in the return data for each product spec index record, add ccrz.ccApiSpec.PSI_ENTITYNAME as a key in this map:
ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiSpec.PSI_ENTITYNAME => new Map<String, Object> {
        ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_M
    }
}
ccrz.ccApiSpec.PRODUCT_IDS
Set<String> of product IDs whose product spec index records you want to return:
new Set<String>{'Product_ID_1', 'Product_ID_2'}
ccrz.ccApiSpec.PRODUCT_SPEC_INDICES
List<Map<String, Object>>, where each Map<String, Object> specifies a spec ID and a particular spec value whose corresponding product spec index records you want to return, such as:
[ {
    "specValues" : [ {
        "value" : "Blue"
    } ],
    "sfid" : "a1h6A00000045s5QAA"
} ]

If you specify multiple values for the same spec, the method applies an OR condition for evaluating all values.

Note

For a spec where Filter Type is Slider, you can specify a filterMin and filterMax range for filtering:

[ {
    "sfid" : "a1h6A00000045s5QAA",
    "filterMin" : "1.0",
    "filterMax" : "10.0"
} ]
ccrz.ccApiSpec.SPECIDLIST
Set<String> of product spec index IDs whose data you want to return:
new Set<String>{'Product_Spec_Index_ID_1', 'Product_Spec_Index_ID_2'}
ccrz.ccApiSpec.SPECLOCALE
String that specifies a locale. The method returns only the product spec index records where the referenced spec has the specified locale.
ccrz.ccApiSpec.USE_FOR_FILTER
Boolean
Value Usage
true Return only product spec index records where the related spec's ccrz__UseForFilter__c field is true.
false (default) Ignore the value of a related spec's ccrz__UseForFilter__c field when querying product spec index records.

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.ccApiSpec.PRODUCT_SPEC_INDICES
Data from the product spec index records that match the fetch query. This return data can take the following types, depending on values specified in the input map:
Type Input Map Criteria
Map<String, Map<String, Object>> Default return format
List<Map<String, Object>>
ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiSpec.PSI_ENTITYNAME => new Map<String, Object> {
        ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_GROUPBY
    }
}
List<ccrz__E_ProductSpecIndex__c>
ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiSpec.PSI_ENTITYNAME => new Map<String, Object> {
        ccrz.ccApi.SZ_SKIPTRZ => true
    }
}
List<AggregateResult>
ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiSpec.PSI_ENTITYNAME => new Map<String, Object> {
        ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_GROUPBY,
        ccrz.ccApi.SZ_SKIPTRZ => true
    }
}

To specify which fields the API returns for each product spec index record, request a specific data size for the ccrz.ccApiSpec.PSI_ENTITYNAME key in your input data:

ccrz.ccApi.SIZING => new Map<String, Object> {
    ccrz.ccApiSpec.PSI_ENTITYNAME => new Map<String, Object> {
        ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_M
    }
}

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

Tip