Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
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/v68.0/actions/standard/addEligibleInsuranceClauses
- Formats
- JSON, XML
- HTTP Methods
- POST
- Authentication
- Authorization: Bearertoken
Inputs
| Input | Details |
|---|---|
| contextId |
|
| instanceKey |
|
| insuranceProductClauses |
|
| optionFlags |
|
| quoteId |
|
| quoteLineItemId |
|
Outputs
| Output | Details |
|---|---|
| errorsList |
|
| isSuccess |
|
| quoteLineItemInsProductClauseIds |
|
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]