Newer Version Available

This content describes an older version of this product. View Latest

Update Insurance Quote Action

Update an existing insurance quote by adding, updating, or deleting nodes and optionally executing pricing and rules.

This action is available in API version 66.0 and later.

Supported REST HTTP Methods

URI
/services/data/v66.0/actions/standard/updateInsuranceQuote
Formats
JSON, XML
HTTP Methods
POST
Authentication
Authorization: Bearertoken

Inputs

Input Details
addedNodes
Type

string

Description
JSON string that contains the set of nodes that must be added to the quote.
additionalFields
Type

string

Description
JSON string that contains additional fields that must be updated in the quote context.
contextId
Type

string

Description
ID of the context that's used to issue the quote update.
deletedNodes
Type

string

Description
JSON string that contains the set of nodes that must be deleted from the quote.
pricingProcedureApiName
Type

string

Description
API name of the pricing procedure that's used to price the product.
quoteId
Type

string

Description
Required.
ID of the insurance quote that must be updated.
quoteOptions
Type

Apex-defined

Description
An Apex runtime_industries_insurance.UpdateInsuranceQuoteOptions record that contains the configuration and execution options to update the quote.
updatedNodes
Type

string

Description
JSON string that contains the set of nodes that must be updated in the quote.

Outputs

Output Details
contextId
Type

string

Description
ID of the context that's used to issue the quote update.
errorsList
Type

string

Description
List of errors that occurred during the update operation.
isSuccess
Type

boolean

Description
Indicates whether the update operation is successful (true) or not (false).
quoteId
Type

string

Description
Required.
ID of the insurance quote that's updated.

Example

POST

This sample request is for the Update Insurance Quote action.

1{
2  "inputs": [
3    {
4      "quoteId": "0Q0xx000000001xAAA",
5      "contextId": "11oxx000001G0lUAAS",
6      "pricingProcedureApiName": "StandardPricing",
7      "addedNodes": "[{\"productCode\":\"autoBundle\",\"instanceKeys\":[\"multiAuto\",\"autoBundle\"],\"attributes\":{\"VehicleYear\":\"2024\",\"VehicleMake\":\"Toyota\"},\"items\":[{\"productCode\":\"auto\",\"instanceKeys\":[\"multiAuto\",\"autoBundle\",\"auto\"],\"attributes\":{\"VehicleType\":\"Sedan\"}}]}]",
8      "updatedNodes": "[{\"productCode\":\"driver\",\"instanceKeys\":[\"multiAuto\",\"autoBundle\",\"driverTom\"],\"attributes\":{\"DriverAge\":\"35\",\"LicenseNumber\":\"D1234567\"}}]",
9      "deletedNodes": "[{\"productCode\":\"coverage\",\"instanceKeys\":[\"multiAuto\",\"autoBundle\",\"auto\",\"collision\"]}]",
10      "additionalFields": "{\"customField1\":\"value1\",\"customField2\":\"value2\"}",
11      "quoteOptions": {
12        "executePricing": true,
13        "executeConfigurationRules": true,
14        "executeQualificationRules": false,
15        "validateProductCatalog": true,
16        "saveQuote": false
17      }
18    }
19  ]
20}

This is a sample request to call this invocable action from Apex code.

1// Sample Apex call for updateInsuranceQuote invocable action
2public class UpdateInsuranceQuoteInvoke {
3    private static final String ACTION_NAME = 'updateInsuranceQuote';
4
5    public static Boolean invokeMethod(Map<String, Object> inputs, Map<String, Object> output) {
6        if (output == null) {
7            output = new Map<String, Object>();
8        }
9
10        try {
11            Invocable.Action action = Invocable.Action.createStandardAction(ACTION_NAME);
12
13            // Required input
14            setInvocationParameter(action, inputs, 'quoteId', false);
15
16            // Optional inputs
17            setInvocationParameter(action, inputs, 'contextId', false);
18            setInvocationParameter(action, inputs, 'addedNodes', true);
19            setInvocationParameter(action, inputs, 'updatedNodes', true);
20            setInvocationParameter(action, inputs, 'deletedNodes', true);
21            setInvocationParameter(action, inputs, 'additionalFields', true);
22
23            // quoteOptions is required by the IA contract
24            if (inputs != null && inputs.containsKey('quoteOptions')) {
25                Map<String, Object> optionsFromInput =
26                    (Map<String, Object>) inputs.get('quoteOptions');
27                if (optionsFromInput != null) {
28                    runtime_industries_insurance.UpdateInsuranceQuoteOptions quoteOptions =
29                        new runtime_industries_insurance.UpdateInsuranceQuoteOptions();
30                    if (optionsFromInput.containsKey('executePricing')) {
31                        quoteOptions.executePricing =
32                            (Boolean) optionsFromInput.get('executePricing');
33                    }
34                    if (optionsFromInput.containsKey('validateProductCatalog')) {
35                        quoteOptions.validateProductCatalog =
36                            (Boolean) optionsFromInput.get('validateProductCatalog');
37                    }
38                    if (optionsFromInput.containsKey('executeConfigurationRules')) {
39                        quoteOptions.executeConfigurationRules =
40                            (Boolean) optionsFromInput.get('executeConfigurationRules');
41                    }
42                    if (optionsFromInput.containsKey('executeQualificationRules')) {
43                        quoteOptions.executeQualificationRules =
44                            (Boolean) optionsFromInput.get('executeQualificationRules');
45                    }
46                    if (optionsFromInput.containsKey('saveQuote')) {
47                        quoteOptions.saveQuote =
48                            (Boolean) optionsFromInput.get('saveQuote');
49                    }
50                    action.setInvocationParameter('quoteOptions', quoteOptions);
51                }
52            }
53
54            List<Invocable.Action.Result> results = action.invoke();
55            if (results != null && !results.isEmpty() && results[0].isSuccess()) {
56                output.put('output', results[0].getOutputParameters());
57                output.put('success', true);
58                return true;
59            }
60
61            output.put('success', false);
62            if (results != null && !results.isEmpty()) {
63                output.put('errors', results[0].getErrors());
64            }
65            return false;
66        } catch (Exception e) {
67            output.put('success', false);
68            output.put('errorMessage', e.getMessage());
69            return false;
70        }
71    }
72
73    private static void setInvocationParameter(
74        Invocable.Action action,
75        Map<String, Object> payload,
76        String attribute,
77        Boolean serializeJson
78    ) {
79        if (payload != null && payload.containsKey(attribute) && payload.get(attribute) != null) {
80            if (serializeJson) {
81                action.setInvocationParameter(attribute, JSON.serialize(payload.get(attribute)));
82            } else {
83                action.setInvocationParameter(attribute, payload.get(attribute));
84            }
85        }
86    }
87}

This sample response is for the Update Insurance Quote action.

1[
2  {
3    "actionName": "repriceInsuranceProduct",
4    "errors": null,
5    "invocationId": null,
6    "isSuccess": true,
7    "outcome": null,
8    "outputValues": {
9      "isSuccess": true,
10      "quoteId": "0Q0xx000000001xAAA",
11      "contextId": "11oxx000001G0lUAAS",
12      "errorsList": "[]"
13    },
14    "sortOrder": -1,
15    "version": 1
16  }
17]