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/vXX.X/actions/standard/updateInsuranceQuote

Where XX.X is the latest API version.

Formats: JSON, XML

HTTP Methods: POST

Authentication: Authorization: Bearer TOKEN

Where TOKEN is your OAuth access token.

Inputs 

InputTypeDescription
addedNodesstringJSON string that contains the set of nodes that must be added to the quote.
additionalFieldsstringJSON string that contains additional fields that must be updated in the quote context.
contextIdstringID of the context that’s used to issue the quote update.
deletedNodesstringJSON string that contains the set of nodes that must be deleted from the quote.
pricingProcedureApiNamestringAPI name of the pricing procedure that’s used to price the product.
quoteIdstringRequired. ID of the insurance quote that must be updated.
quoteOptionsApex-definedAn Apex runtime_industries_insurance.UpdateInsuranceQuoteOptions record that contains the configuration and execution options to update the quote.
updatedNodesstringJSON string that contains the set of nodes that must be updated in the quote.

Outputs 

OutputTypeDescription
contextIdstringID of the context that’s used to issue the quote update.
errorsListstringList of errors that occurred during the update operation.
isSuccessbooleanIndicates whether the update operation is successful ( true ) or not ( false ).
quoteIdstringRequired. 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]