Get Product Details Action
This action is available in API version 62.0 and later.
Special Access Rules
The Get Product Details action is available in Enterprise, Unlimited, and Developer Editions where Product Discovery is enabled.
Supported REST HTTP Methods
- URI
- /services/data/v63.0/actions/standard/getProductDetails
- Formats
- JSON, XML
- HTTP Methods
- POST
- Authentication
- Authorization: Bearer token
Inputs
Input | Details |
---|---|
additionalContextData |
|
additionalFields |
|
catalogId |
|
contextDefinition |
|
contextMapping |
|
correlationId |
|
currencyCode |
|
enablePricing |
|
enableQualification |
|
priceBookId |
|
pricingProcedure |
|
productId |
|
productSellingModelId |
|
qualificationProcedure |
|
userContext |
|
Outputs
Output | Details |
---|---|
apiStatus |
|
contextId |
|
correlationId |
|
results |
|
userContext |
|
Example
- POST
-
This sample request is for the Get Product Details action.
{ "inputs": [{ "additionalContextData": [ { "nodeName": "Contract", "nodeData": { "id": "xxxxx231", "name": "Contract1" } }, { "nodeName": "Lead", "nodeData": { "id": "lllllll31", "name": "Lead1" } } ], "additionalFields": { "Product2": { "fields": [ "CustomField1__c", "StandardField1" ] } }, "correlationId": "9cbb9650-48c5-11ed-96d1-0afcf185843b", "catalogId": "0ZSxx0000000001GAA", "currencyCode": "USD", "priceBookId": "01sxx0000005puLAAQ", "productId": "01txx0000006j08AAA", "productSellingModelId": "0jPxx000000004rEAA", "userContext": { "accountId": "001xx0000000001AAA" }, "enableQualification": true, "enablePricing": true, "qualificationProcedure": "QualificationProcedure", "pricingProcedure": "Preview", "contextDefinition": "TestDefinition", "contextMapping": "TestDefinitionNode" }] }
-
This is the sample response for the Get Product Details action.
{ "apiStatus": { "messages": [], "statusCode": "FETCHED_DETAILS_SUCCESSFULLY" }, "contextId": "0U3RM00000000SR0AY", "correlationId": "9cbb9650-48c5-11ed-96d1-0afcf185843b", "result": [ { "additionalFields": { "CustomField1__c": "TextValue", "CustomField2__c": "10", "StandardField1": "false" }, "description": "IPhone-13", "id": "01txx0000006kYwAAI", "name": "Sample product 1", "prices": [ { "price": 150, "priceBookEntryId": "12Axx0000004DF7EAM", "priceBookId": "01sxx0000005puLAAQ", "pricingModel": { "frequency": "Monthly", "id": "12Bxx000000CiCDEA0", "name": "IPhone-13", "occurrence": 6, "pricingModelType": "Recurring" } }, { "price": 400, "priceBookEntryId": "12Axx0000004DGjEAM", "priceBookId": "01sxx0000005puLAAQ", "pricingModel": { "id": "12Bxx000000CiCCEA0", "name": "IPhone-13", "pricingModelType": "OneTime" } } ], "qualificationContext": { "isQualified": true } }, { "additionalFields": { "CustomField1__c": "TextValue", "CustomField2__c": "10", "StandardField1": "false" }, "description": "Sample product 2", "name": "Sample product 2", "id": "01txx0000006kYwAAI", "prices": [], "qualificationContext": { "isQualified": false } }, { "description": "Sample product 3", "name": "Sample product 3", "id": "01txx0000006kYwAAI", "prices": [], "qualificationContext": { "isQualified": true } } ], "userContext": { "accountId": "001xx0000000001AAA" } }
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.
public class ProductServiceAction { // Define input parameters public class FlowInput{ @InvocableVariable(required=false) public String objectApiName; @InvocableVariable(required=false) public String recordId; } // Define output parameters public class FlowOutput{ @invocableVariable public runtime_industries_cpq.AdditionalContextData additionalContextDataFinalOutput = new runtime_industries_cpq.AdditionalContextData(); } // This method is invoked from a Flow @InvocableMethod(label='Process Input' description='Creates the Array of ContextDataInput for additional Context Data') public static List<FlowOutput> processContextData(List<FlowInput> inputs){ String apiName; String recId; FlowOutput output = new FlowOutput(); // Capture input from the flow for(FlowInput input: inputs){ apiName = input.objectApiName; recId = input.recordId; } // Populate the ContextDataInput list to store additional context data List<runtime_industries_cpq.ContextDataInput> listContextData = new List<runtime_industries_cpq.ContextDataInput>(); runtime_industries_cpq.ContextDataInput cd1 = new runtime_industries_cpq.ContextDataInput(); cd1.nodeName = apiName; cd1.nodeData = new Map<String, Object>(); cd1.nodeData.put('id',recId); listContextData.add(cd1); output.additionalContextDataFinalOutput.additionalContextData = listContextData; List<FlowOutput> flowOutputs = new List<FlowOutput>(); flowOutputs.add(output); List<runtime_industries_cpq.RelatedObjectFilter> relatedObjectFilterList = new List<runtime_industries_cpq.RelatedObjectFilter>(); runtime_industries_cpq.RelatedObjectFilter relatedObjectFilter = new runtime_industries_cpq.RelatedObjectFilter(); relatedObjectFilter.objectName = 'ProductSpecificationRecType'; List<runtime_industries_cpq.FilterCriteriaInputRepresentation> criteriaList = new List<runtime_industries_cpq.FilterCriteriaInputRepresentation>(); runtime_industries_cpq.FilterCriteriaInputRepresentation criteria = new runtime_industries_cpq.FilterCriteriaInputRepresentation(); criteria.property = 'IsCommercial'; criteria.operator = 'eq'; criteria.value = 'true'; criteriaList.add(criteria); relatedObjectFilter.criteria = criteriaList; relatedObjectFilterList.add(relatedObjectFilter); output.relatedObjectFilter.relatedObjectFilter = relatedObjectFilterList; output.userContext.accountId = '001DU000001nx9BYAQ'; return flowOutputs; } }
- 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.