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.

Renew Multi-Root Insurance Policy Action

Renew an existing multi-root insurance policy along with its associated child policies asynchronously.

This action is available in API version 66.0 and later.

Supported REST HTTP Methods

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

Inputs

Input Details
renewMultiRootPolicyInputRep
Type

Apex-defined

Description
Required. An Apex ConnectApi.RenewMultiRootPolicyInputRep record that contains the details to renew the multi-root insurance policy. To calculate billing, specify billingRecord if Career Billing is enabled in your org.

Outputs

Output Details
jobIdentifier
Type

string

Description
A unique system-generated ID for the job that processes the renewal of the multi-root insurance policy.

Example

POST

This sample request is for the Renew Multi-Root Insurance Policy action.

1{
2  "inputs": [
3    {
4      "renewMultiRootPolicyInputRep": {
5        "contextId": "d767b27ec095f9f95c5a34299e3bd6f507df23e8d0692dfed17f98dcb5b661b6",
6        "policyId": "0YTxx00000001ovGAA",
7        "insurancePolicy": {
8          "policyName": "Renewed_Auto_Policy_00002",
9          "policyNumber": "Renewed Auto Policy 00002",
10          "effectiveFromDate": "2025-01-01",
11          "effectiveToDate": "2025-12-31"
12        },
13        "transactionRecord": {
14          "name": "Renew Transaction"
15        },
16        "billingRecord": {
17           "billDayOfMonth": 15,
18            "billToContact": "003xx000000001aEAA"
19        },
20        "additionalInput": [
21          {
22            "instanceKey": "AutoBundle2",
23            "additionalFieldsList": [
24              {
25                "key": "AssetDescription__c",
26                "value": "Test_AssetDescription__c"
27              },
28              {
29                "key": "SourceSystem",
30                "value": "Test_SourceSystem"
31              }
32            ]
33          },
34          {
35            "instanceKey": "AutoDriver",
36            "additionalFieldsList": [
37              {
38                "key": "ParticipantName",
39                "value": "Test_ParticipantName"
40              },
41              {
42                "key": "Participant_Hometown__c",
43                "value": "Test_Participant_Hometown__c"
44              }
45            ]
46          },
47          {
48            "instanceKey": "AutoRoot",
49            "additionalFieldsList": [
50              {
51                "key": "Primary_Policy_Holder__c",
52                "value": "Test_Primary_Policy_Holder__c"
53              },
54              {
55                "key": "PolicyDescription",
56                "value": "Test_PolicyDescription"
57              }
58            ]
59          },
60          {
61            "instanceKey": "AutoBundle2_AutoComp1",
62            "additionalFieldsList": [
63              {
64                "key": "Coverage_Description__c",
65                "value": "Test_Coverage_Description__c"
66              },
67              {
68                "key": "Description",
69                "value": "Test_Description"
70              }
71            ]
72          }
73        ]
74      }
75    }
76  ]
77}

This is a sample code to call the Renew Multi-Root Insurance Policy action from Apex.

1public with sharing class MultiRootPolicyRenewalInvocable {
2    
3    /**
4     * Execute Multi-Root Policy Renewal with parameters map
5     * Usage: MultiRootPolicyRenewalInvocable.executeMultiRootRenewal(paramsMap);
6     * 
7     * @param params Map of parameters:
8     *   - contextId (String, REQUIRED)
9     *   - policyId (String, REQUIRED)
10     *   - policyName (String, optional)
11     *   - effectiveFromDate (String, optional)
12     *   - effectiveToDate (String, optional)
13     *   - transactionName (String, optional)
14     *   - additionalFields (Map<String, Map<String, String>>, optional)
15     */
16    public static void executeMultiRootRenewal(Map<String, Object> params) {
17        // Extract and validate contextId (REQUIRED)
18        String contextId = (String) params.get('contextId');
19        if (String.isBlank(contextId)) {
20            System.debug('ERROR: contextId is required');
21            return;
22        }
23        
24        // Extract and validate policyId (REQUIRED)
25        String policyId = (String) params.get('policyId');
26        if (String.isBlank(policyId)) {
27            System.debug('ERROR: policyId is required');
28            return;
29        }
30        
31        // Multi-Root Renew Policy IA - Create the standard Invocable Action
32        Invocable.Action action = Invocable.Action.createStandardAction('renewMultiRootInsurancePolicy');
33        
34        // Instantiate the IA input object for Multi-Root Policy Renewal
35        // IMPORTANT: Use RenewMultiRootPolicyInputRep
36        ConnectApi.RenewMultiRootPolicyInputRep policyInput = 
37            new ConnectApi.RenewMultiRootPolicyInputRep();
38        
39        // Set context ID and policy ID (REQUIRED)
40        policyInput.contextId = contextId;
41        policyInput.policyId = policyId;
42        
43        // Extract optional parameters
44        String policyName = (String) params.get('policyName');
45        String effectiveFromDate = (String) params.get('effectiveFromDate');
46        String effectiveToDate = (String) params.get('effectiveToDate');
47        String transactionName = (String) params.get('transactionName');
48        Map<String, Map<String, String>> additionalFields = 
49            (Map<String, Map<String, String>>) params.get('additionalFields');
50        
51        // Populate Insurance Policy details (using IA classes) - all optional
52        if (!String.isBlank(policyName) || !String.isBlank(effectiveFromDate) || 
53            !String.isBlank(effectiveToDate)) {
54            
55            ConnectApi.InsPolicyIAInputRep insurancePolicy = 
56                new ConnectApi.InsPolicyIAInputRep();
57            
58            if (!String.isBlank(policyName)) {
59                insurancePolicy.policyName = policyName;
60            }
61            if (!String.isBlank(effectiveFromDate)) {
62                insurancePolicy.effectiveFromDate = effectiveFromDate;
63            }
64            if (!String.isBlank(effectiveToDate)) {
65                insurancePolicy.effectiveToDate = effectiveToDate;
66            }
67            
68            policyInput.insurancePolicy = insurancePolicy;
69        }
70        
71        // Populate Transaction record (using IA transaction representation) - optional
72        if (!String.isBlank(transactionName)) {
73            ConnectApi.InsPolicyTrxnIAInputRep transactionRecord = 
74                new ConnectApi.InsPolicyTrxnIAInputRep();
75            transactionRecord.name = transactionName;
76            policyInput.transactionRecord = transactionRecord;
77        }
78        
79        // Populate additional input for multi-root policies - optional
80        if (additionalFields != null && !additionalFields.isEmpty()) {
81            List<ConnectApi.InsPolicyAddlInputIARep> additionalInputList = new List<ConnectApi.InsPolicyAddlInputIARep>();
82            
83            for (String instanceKey : additionalFields.keySet()) {
84                ConnectApi.InsPolicyAddlInputIARep additionalInput = 
85                    new ConnectApi.InsPolicyAddlInputIARep();
86                
87                // Set instance key (e.g., "AutoSilver", "FamilyHealth")
88                additionalInput.instanceKey = instanceKey;
89                
90                // Build additional fields list for this instance
91                Map<String, String> fieldsMap = additionalFields.get(instanceKey);
92                if (fieldsMap != null && !fieldsMap.isEmpty()) {
93                    List<ConnectApi.AdditionalFieldIARep> fieldsList = new List<ConnectApi.AdditionalFieldIARep>();
94                    
95                    for (String fieldKey : fieldsMap.keySet()) {
96                        ConnectApi.AdditionalFieldIARep field = new ConnectApi.AdditionalFieldIARep();
97                        field.key = fieldKey;
98                        field.value = fieldsMap.get(fieldKey);
99                        fieldsList.add(field);
100                    }
101                    
102                    additionalInput.additionalFieldsList = fieldsList;
103                }
104                
105                additionalInputList.add(additionalInput);
106            }
107            
108            policyInput.additionalInput = additionalInputList;
109        }
110        
111        // Set invocation parameters
112        // IMPORTANT: Parameter name is renewMultiRootPolicyInputRep (camelCase)
113        action.setInvocationParameter('renewMultiRootPolicyInputRep', policyInput);
114        
115        System.debug('Starting Multi-Root Policy Renewal Invocable Action (renewMultiRootInsurancePolicy)...');
116        System.debug('Context ID: ' + contextId);
117        System.debug('Policy ID: ' + policyId);
118        if (!String.isBlank(policyName)) {
119            System.debug('Policy Name: ' + policyName);
120        }
121        
122        try {
123            // Invoke the action
124            List<Invocable.Action.Result> results = action.invoke();
125            
126            System.debug('Multi-Root Policy Renewal IA result = ' + results);
127            
128            // Process results
129            for (Invocable.Action.Result result : results) {
130                if (result.isSuccess()) {
131                    System.debug('SUCCESS: Multi-Root Policy Renewal completed successfully!');
132                    Object outputValue = result.getOutputParameters().get('jobIdentifier');
133                    if (outputValue != null) {
134                        System.debug('Job Identifier: ' + outputValue);
135                    } else {
136                        System.debug('Multi-Root Policy Renewal job started - result: ' + result.getOutputParameters());
137                    }
138                } else {
139                    System.debug('ERROR: Multi-Root Policy Renewal failed');
140                    System.debug('Error Details: ' + result.getErrors());
141                }
142            }
143            
144        } catch (Exception e) {
145            System.debug('EXCEPTION in Multi-Root Policy Renewal Invocable Action: ' + e.getMessage());
146            System.debug('Stack Trace: ' + e.getStackTraceString());
147        }
148    }
149}
150
151/*
152 * USAGE EXAMPLE:
153 * Copy and paste this code into Developer Console Execute Anonymous Window
154 */
155Map<String, Object> params = new Map<String, Object>();
156params.put('contextId', <your-context-id-here>); // REQUIRED
157params.put('policyId', <your-policy-id-here>); // REQUIRED
158params.put('policyName', 'Renewed Multi-Root Policy');
159params.put('effectiveFromDate', '2026-01-01');
160params.put('effectiveToDate', '2027-01-01');
161params.put('transactionName', 'Multi-Root Annual Renewal with Updates');
162
163// Build additional fields configuration
164Map<String, Map<String, String>> additionalFields = new Map<String, Map<String, String>>();
165
166// Configuration for AutoSilver instance
167Map<String, String> autoFields = new Map<String, String>();
168autoFields.put('PolicyName', 'James Auto Policy');
169autoFields.put('Name', 'James Auto Policy');
170additionalFields.put(<your-instanceKey-goes-here>, autoFields);
171
172// Configuration for FamilyHealth instance
173Map<String, String> healthFields = new Map<String, String>();
174healthFields.put('PolicyName', 'James Medical Policy');
175healthFields.put('Name', 'James Medical Policy');
176additionalFields.put(<your-instanceKey-goes-here>, healthFields);
177
178params.put('additionalFields', additionalFields);
179
180MultiRootPolicyRenewalInvocable.executeMultiRootRenewal(params);

This sample response is for the Renew Multi-Root Insurance Policy action.

1[
2  {
3    "actionName": "renewMultiRootInsurancePolicy",
4    "errors": null,
5    "invocationId": null,
6    "isSuccess": true,
7    "outcome": null,
8    "outputValues": {
9      "jobIdentifier": "XYTSG000000PgX74AK"
10    },
11    "sortOrder": -1,
12    "version": 1
13  }
14]