Newer Version Available

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

Add Eligible Insurance Clauses Action

Add eligible insurance clauses to a quote or context. You must specify either a quote ID or a context ID, and either an instance key or a quote line item ID along with insurance product clause details.

This action is available in API version 65.0 and later.

Supported REST HTTP Methods

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

Inputs

Input Details
contextId
Type

string

Description
Required if quoteId isn't specified.
Context ID of the insurance quote.
instanceKey
Type

string

Description
Required if quoteLineItemId isn't specified.
Unique key that identifies the product to which a quote line item belongs.
insuranceProductClauses
Type

string

Description
Required.
JSON object with the details of the insurance product clauses to add.
optionFlags
Type

Apex-defined

Description
An Apex runtime_industries_insurance.AddEligibleInsuranceClausesOptions record that contains the details to add eligible clauses to an insurance product.
quoteId
Type

string

Description
Required if contextId isn't specified.
ID of the insurance quote to add eligible clauses.
quoteLineItemId
Type

string

Description
Required if instanceKey isn't specified.
ID of the quote line items for adding eligible clauses.

Outputs

Output Details
errorsList
Type

string

Description
Errors that are encountered during the operation.
isSuccess
Type

boolean

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

string

Description
IDs of the quote line item insurance product clauses.

Example

Sample Request

1{
2  "inputs": [
3    {
4      "quoteId": "0Q0xx0000000001AAA",
5      "quoteLineItemId": "0QLxx0000000002BBB",
6      "contextId": "0j5xx0000000003CCC",
7      "instanceKey": [
8        "Auto",
9        "Liability"
10      ],
11      "insuranceProductClauses": [
12        {
13          "insuranceProductClauseId": "0j4xx0000000004DDD",
14          "effectiveDate": "2025-01-01",
15          "expirationDate": "2025-12-31"
16        }
17      ],
18      "optionFlags": {
19        "saveContext": true
20      }
21    }
22  ]
23}

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

1public class AddEligibleInsuranceClausesInvoke {
2    private static final String ACTION_NAME = 'addEligibleInsuranceClauses';
3
4    public static Boolean invokeMethod(Map<String, Object> inputs, Map<String, Object> output) {
5        if (output == null) {
6            output = new Map<String, Object>();
7        }
8
9        try {
10            Invocable.Action action = Invocable.Action.createStandardAction(ACTION_NAME);
11
12            // Either quoteId or contextId is required
13            setInvocationParameter(action, inputs, 'quoteId', false);
14            setInvocationParameter(action, inputs, 'contextId', false);
15
16            // Either quoteLineItemId or instanceKey is required
17            setInvocationParameter(action, inputs, 'quoteLineItemId', false);
18            setInvocationParameter(action, inputs, 'instanceKey', false);
19
20            // insuranceProductClauses expects JSON
21            setInvocationParameter(action, inputs, 'insuranceProductClauses', true);
22
23            // Optional optionFlags map
24            if (inputs != null && inputs.containsKey('optionFlags')) {
25                Map<String, Object> addClauseOptions =
26                    (Map<String, Object>) inputs.get('optionFlags');
27                if (addClauseOptions != null) {
28                    runtime_industries_insurance.AddEligibleInsuranceClausesOptions apexOptions =
29                        new runtime_industries_insurance.AddEligibleInsuranceClausesOptions();
30                    if (addClauseOptions.containsKey('saveContext')) {
31                        apexOptions.SaveContext =
32                            (Boolean) addClauseOptions.get('saveContext');
33                    }
34                    action.setInvocationParameter('addClauseOptions', apexOptions);
35                }
36            }
37
38            List<Invocable.Action.Result> results = action.invoke();
39            if (results != null && !results.isEmpty() && results[0].isSuccess()) {
40                output.put('output', results[0].getOutputParameters());
41                output.put('success', true);
42                return true;
43            }
44
45            output.put('success', false);
46            if (results != null && !results.isEmpty()) {
47                output.put('errors', results[0].getErrors());
48            }
49            return false;
50        } catch (Exception e) {
51            output.put('success', false);
52            output.put('errorMessage', e.getMessage());
53            return false;
54        }
55    }
56
57    private static void setInvocationParameter(
58        Invocable.Action action,
59        Map<String, Object> payload,
60        String attribute,
61        Boolean serializeJson
62    ) {
63        if (payload != null && payload.containsKey(attribute) && payload.get(attribute) != null) {
64            if (serializeJson) {
65                action.setInvocationParameter(attribute, JSON.serialize(payload.get(attribute)));
66            } else {
67                action.setInvocationParameter(attribute, payload.get(attribute));
68            }
69        }
70    }
71}

Sample Response

1[
2  {
3    "actionName": "addEligibleInsuranceClauses",
4    "errors": null,
5    "invocationId": null,
6    "isSuccess": true,
7    "outcome": null,
8    "outputValues": {
9      "isSuccess": true,
10      "quoteLineItemInsProductClauseIds": [
11        "a1Cxx0000000001AAA"
12      ],
13      "errorsList": []
14    },
15    "sortOrder": -1,
16    "version": 1
17  }
18]