Execute Qualification Procedure Action

Execute a qualification procedure, which returns the qualification status for the specified products.

This action is available in API version 64.0 and later.

You can invoke this action via Apex and Flows only.

Special Access Rules 

The Execute Qualification Procedure action is available in Enterprise, Unlimited, and Developer Editions where Product Discovery is enabled.

Inputs 

InputTypeDescription
additionalContextDataApex-definedCollection of Apex AdditionalContextData records that contain additional context data for nodes of the custom context definition, if applicable. You can add details for up to 10 nodes. See AdditionalContextData.
contextDefinitionNamestringName of the custom context definition that’s used to create context data for categories. If null, the default context definition is used.
contextMappingNamestringName of the context mapping. By default, the default context mapping associated with the context definition is used.
correlationIdstringUnique identifier attached to requests and messages, allowing reference to a specific transaction or event chain.
productIdsstringRequired. Collection of IDs of products that are to be checked for qualification.
qualificationProcedureNamestringName of the custom qualification procedure that’s executed to determine the category list. If null, the default qualification procedure is executed.
userContextInputRepresentationApex-definedAn Apex UserContextInputRepresentation record that contains user details, such as account ID, geographical location, language preferences, and more.

Outputs 

OutputTypeDescription
apiStatusOutputRepresentationApex-definedAn Apex ApiStatusOutputRepresentation record that contains the status of the request, including the status code and message.
contextIdstringID of the context that’s created by using the specified context definition.
correlationIdstringUnique identifier attached to requests and messages, allowing reference to a specific transaction or event chain.
qualificationResultRepresentationsApex-definedCollection of Apex QualificationResultRepresentation records that contain details about the qualified product.

Example 

Here’s a sample input to call this invocable action from Apex code.

1Invocable.Action action = Invocable.Action.createStandardAction('executeQualificationProcedure');
2
3ConnectApi.UserContextInputRepresentation userContext = new ConnectApi.UserContextInputRepresentation();
4userContext.accountId = '001xx000003GYiEAAW';
5
6runtime_industries_cpq.ContextDataInput data = new runtime_industries_cpq.ContextDataInput();
7String nodeNameVal = 'Quote__c';
8Map<String,Object> nodeDataVal = new Map<String,Object>();
9nodeDataVal.put('id',(Object)'0Q0xx0000004CDsCAM');
10nodeDataVal.put('businessObjectType',(Object)'Quote');
11data.nodeName = nodeNameVal;
12data.nodeData = nodeDataVal;
13List<runtime_industries_cpq.ContextDataInput> contextData= new List<runtime_industries_cpq.ContextDataInput>();
14contextData.add(data);
15runtime_industries_cpq.AdditionalContextData additionalContextDataOut = new runtime_industries_cpq.AdditionalContextData();
16additionalContextDataOut.additionalContextData = new List<runtime_industries_cpq.ContextDataInput>();
17additionalContextDataOut.additionalContextData.add(data);
18
19List<String> productIds = new List<String>();
20prodIds.add('01txx0000006i2ZAAQ');
21prodIds.add('01txx0000006i35AAA');
22action2.setInvocationParameter('productIds', productIds);
23action.setInvocationParameter('correlationId', '9cbb9650-48c5-11ed-96d1-0afcf185843b');
24action.setInvocationParameter('userContextInputRepresentation', userContext);
25action.setInvocationParameter('qualificationProcedureName', 'CatQual02');
26action.setInvocationParameter('contextDefinitionName', 'CategoryCD');
27action.setInvocationParameter('contextMappingName', 'ProductDiscoveryMapping');
28action.setInvocationParameter('additionalContextData', additionalContextDataOut);
29
30List<Invocable.Action.Result> results = action.invoke();
31System.debug('Execute Qualification Procedure Action + '+results);

Here’s a sample response when you call this action.

1[
2  {
3    "actionName": "executeQualificationProcedure",
4    "errors": null,
5    "invocationId": null,
6    "isSuccess": true,
7    "outcome": null,
8    "outputValues": {
9      "apiStatusOutputRepresentation": {
10        "statusMessage": null,
11        "statusCode": "FetchedDetailsSuccessfully",
12        "messages": []
13      },
14      "qualificationResultRepresentations": [
15        {
16          "qualificationContext": {
17            "reason": null,
18            "isQualified": true
19          },
20          "productId": "01tSG000007uDL8YAM"
21        },
22        {
23          "qualificationContext": {
24            "reason": "Product is not qualified because one or more field(s) do not match the qualification criteria. Fields:- ProductId - 01tSG000007uDLBYA2 Max_Number_of_Employees - 50 Min_Number_of_Employees - 50 RootProductId - ",
25            "isQualified": false
26          },
27          "productId": "01tSG000007uDLBYA2"
28        }
29      ],
30      "correlationId": "9cbb9650-48c5-11ed-96d1-0afcf185843b",
31      "contextId": "0000000b28op21g00251747224654739cade16577eac4c8fb5d94a20d952fdab"
32    },
33    "sortOrder": -1,
34    "version": 1
35  }
36]