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
Input
Type
Description
additionalContextData
Apex-defined
An 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.
additionalFields
Apex-defined
An 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.
catalogId
string
Catalog ID that’s used to find and retrieve the products.
contextDefinition
string
API 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.
contextMapping
string
API name of the context mapping for data hydration. The value of this parameter is used only if it belongs to the specified context definition.
correlationId
string
Currency code that’s used to calculate and show prices. Only the products with the currency code matching the specified currency code are fetched.
currencyCode
string
Currency code that’s used to calculate and show prices.
enablePricing
boolean
Indicates 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.
enableQualification
boolean
Indicates 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.
priceBookId
string
ID of the pricebook from which you want to retrieve the pricing details.
pricingProcedure
string
API 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.
productId
string
Required. ID of the product to get the details for.
productSellingModelId
string
ID of the product selling model.
qualificationProcedure
string
API 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.
userContext
Apex-defined
An Apex ConnectApi.UserContextInputRepresentation record that contains the user details to evaluate product eligibility and calculate prices.
An 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 parameters3 public class FlowInput{4 @InvocableVariable(required=false)5 public String objectApiName;67 @InvocableVariable(required=false)8 public String recordId;9 }1011 // Define output parameters12 public class FlowOutput{13 @invocableVariable14 public runtime_industries_cpq.AdditionalContextData additionalContextDataFinalOutput = new runtime_industries_cpq.AdditionalContextData();1516 }1718 // This method is invoked from a Flow19 @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();2425 // Capture input from the flow26 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);3738 output.additionalContextDataFinalOutput.additionalContextData = listContextData;39 List<FlowOutput> flowOutputs = new List<FlowOutput>();40 flowOutputs.add(output);4142 List<runtime_industries_cpq.RelatedObjectFilter> relatedObjectFilterList = new List<runtime_industries_cpq.RelatedObjectFilter>();4344 runtime_industries_cpq.RelatedObjectFilter relatedObjectFilter = new runtime_industries_cpq.RelatedObjectFilter();4546 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;5455 relatedObjectFilterList.add(relatedObjectFilter);56 output.relatedObjectFilter.relatedObjectFilter = relatedObjectFilterList;5758 output.userContext.accountId = '001DU000001nx9BYAQ';5960 return flowOutputs;6162 }6364}
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.