Get Product Details Action

Get details such as attributes, hierarchy, and cardinality for the specified product.

This action is available in API version 62.0 and later.

You can invoke this action via Apex and Flows only.

Special Access Rules 

The Get Product Details action is available in Enterprise, Unlimited, and Developer Editions where Product Discovery is enabled.

Inputs 

InputTypeDescription
additionalContextDataApex-definedAn array of Apex runtime_industries_cpq.AdditionalContextData records that contain the additional nodes that are used along with the context definition nodes for data hydration. The maximum number of supported nodes is 10.
additionalFieldsApex-definedAn Apex runtime_industries_cpq.AdditionalFields record that contains an array of additional standard or custom fields to include in the response. The supported objects are Product2 or ProductAttributeDefinition—If the fields defined for the ProductAttributeDefinition object aren’t available for the ProductClassificationAttr object, then the API request fails.
catalogIdstringCatalog ID that’s used to find and retrieve the products.
contextDefinitionstringAPI name of the context definition for context creation. If you don’t provide a value, the context selected on the Product Discovery Settings page from Setup is used.
contextMappingstringAPI name of the context mapping for data hydration. The value of this parameter is used only if it belongs to the specified context definition.
correlationIdstringCurrency code that’s used to calculate and show prices. Only the products with the currency code matching the specified currency code are fetched.
currencyCodestringCurrency code that’s used to calculate and show prices.
enablePricingbooleanIndicates whether the pricing procedure must run (true) or not (false). The default value is true. To use this parameter, you must enable the Pricing Procedure setting from Setup.
enableQualificationbooleanIndicates whether the qualification procedure must run (true) or not (false). The default value is true. To use this parameter, you must enable the Qualification Procedure setting from Setup.
priceBookIdstringID of the pricebook from which you want to retrieve the pricing details.
pricingProcedurestringAPI name of the pricing procedure to calculate product prices. If you don’t specify a value, the pricing procedure selected on the Product Discovery Settings page from Setup is used.
productIdstringRequired. ID of the product to get the details for.
productSellingModelIdstringID of the product selling model.
qualificationProcedurestringAPI name of the qualification procedure to evaluate product eligibility. If you don’t specify a value, the qualification procedure selected on the Product Discovery Settings page from Setup is used.
userContextApex-definedAn Apex ConnectApi.UserContextInputRepresentation record that contains the user details to evaluate product eligibility and calculate prices.

Outputs 

OutputTypeDescription
apiStatusApex-definedAn Apex runtime_industries_cpq.ApiStatusRepresentation record that contains a status code and message.
contextIdstringID of the context that’s created by using the specified context definition.
correlationIdstringID to reference a series of related actions.
resultsApex-definedAn Apex runtime_industries_cpq.ProductDetailsRepresentation record that contains the product details.
userContextApex-definedAn Apex ConnectApi.UserContextRepresentation record that contains the user details.

Usage of an Apex-Defined Data Type in a Flow 

To use an Apex-defined input parameter in a flow, follow these guidelines.

Create an Apex Class

Create an Apex class defining the input and output parameters. In the flow, include the Apex-defined input parameters for which you want to add the details. In this example, we have created a class named ProductServiceAction that takes an object’s API name and record ID as input, and returns the additional context data.

1public class ProductServiceAction {
2    // Define input parameters
3    public class FlowInput{
4        @InvocableVariable(required=false)
5        public String objectApiName;
6        
7        @InvocableVariable(required=false)
8        public String recordId;
9    }
10    
11    // Define output parameters
12    public class FlowOutput{
13        @invocableVariable
14        public runtime_industries_cpq.AdditionalContextData additionalContextDataFinalOutput = new runtime_industries_cpq.AdditionalContextData();
15        
16    }
17    
18    // This method is invoked from a Flow
19    @InvocableMethod(label='Process Input' description='Creates the Array of ContextDataInput for additional Context Data')
20    public static List<FlowOutput> processContextData(List<FlowInput> inputs){
21        String apiName;
22        String recId;
23        FlowOutput output = new FlowOutput();
24        
25    // Capture input from the flow
26        for(FlowInput input: inputs){
27            apiName = input.objectApiName;
28            recId = input.recordId;
29            }
30    // Populate the ContextDataInput list to store additional context data    
31        List<runtime_industries_cpq.ContextDataInput> listContextData = new List<runtime_industries_cpq.ContextDataInput>();
32        runtime_industries_cpq.ContextDataInput cd1 = new runtime_industries_cpq.ContextDataInput();
33        cd1.nodeName = apiName;
34        cd1.nodeData = new Map<String, Object>();
35        cd1.nodeData.put('id',recId);
36        listContextData.add(cd1);
37       
38        output.additionalContextDataFinalOutput.additionalContextData = listContextData;
39        List<FlowOutput> flowOutputs = new List<FlowOutput>();
40        flowOutputs.add(output);
41        
42        List<runtime_industries_cpq.RelatedObjectFilter> relatedObjectFilterList = new List<runtime_industries_cpq.RelatedObjectFilter>();
43       
44        runtime_industries_cpq.RelatedObjectFilter relatedObjectFilter = new runtime_industries_cpq.RelatedObjectFilter();
45
46        relatedObjectFilter.objectName = 'ProductSpecificationRecType';
47        List<runtime_industries_cpq.FilterCriteriaInputRepresentation> criteriaList = new  List<runtime_industries_cpq.FilterCriteriaInputRepresentation>();
48        runtime_industries_cpq.FilterCriteriaInputRepresentation criteria = new runtime_industries_cpq.FilterCriteriaInputRepresentation();
49        criteria.property = 'IsCommercial';
50        criteria.operator = 'eq';
51        criteria.value = 'true';
52        criteriaList.add(criteria);
53        relatedObjectFilter.criteria = criteriaList;
54
55        relatedObjectFilterList.add(relatedObjectFilter);
56        output.relatedObjectFilter.relatedObjectFilter  = relatedObjectFilterList;
57         
58		output.userContext.accountId = '001DU000001nx9BYAQ';
59        
60        return flowOutputs;
61       
62    }
63
64}

Create a Flow with the Necessary Variables and Components: Create a flow that enables users to add a search term to find products. Add the ProductService action that you’ve created above by using Apex. When a flow is invoked from a record, the flow sends the record’s objectApiName and recordId to the Apex class, which then generates the flow output. The flow passes the objectApiName and recordId of the record that the flow is invoked from to the Apex class to generate the flow output. See Example of How to Create a Flow for Product Discovery.

Configure the Action: Configure the action (for example, Get Product Details action) to add values for the Apex-defined input parameters. Use the output of the created Apex class as the input of the Apex-defined parameter in the Get Product Details action, which users can use to get the product details.