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.
ReinstatePolicy(ReinstatePolicyInput, policyId)
Reinstate a previously canceled insurance policy.
API Version
65.0
Requires Chatter
No
Signature
public static ConnectApi.PolicyOutputRepresentation ReinstatePolicy(ConnectApi.ReinstatePolicyInputRepresentation ReinstatePolicyInput, String policyId)
Parameters
- ReinstatePolicyInput
- Type: ConnectApi.ReinstatePolicyInputRepresentation
- Input representation for reinstating an insurance policy.
- policyId
- Type: String
- ID of the insurance policy to be reinstated.
Return Value
Example
Here's an example of how to invoke the Reinstate Policy API by using Apex.
1// Create and populate the ReinstatePolicyInputRepresentation object
2ConnectApi.ReinstatePolicyInputRepresentation policyInput = new ConnectApi.ReinstatePolicyInputRepresentation();
3
4// Populate fields for InsurancePolicyInputRepresentation
5ConnectApi.InsurancePolicyInputRepresentation insurancePolicy = new ConnectApi.InsurancePolicyInputRepresentation();
6insurancePolicy.policyName = 'Health Insurance Policy Reinstated';
7insurancePolicy.policyNumber = 'HIPE12';
8
9// Create the list that will hold the AdditionalFieldsMapValue wrappers.
10List<ConnectApi.AdditionalFieldsMapValue> additionalFieldsValueList = new List<ConnectApi.AdditionalFieldsMapValue>();
11
12// 1. Create the map containing the actual field data for ONE item.
13Map<String, Object> dataForFirstMapValue = new Map<String, Object>();
14dataForFirstMapValue.put('instanceKey', 'AutoSilver'); // Example key/value from your JSON structure
15Map<String, Object> innerFieldsMap = new Map<String, Object>();
16innerFieldsMap.put('Currency__c', '4456'); // Example inner field value
17dataForFirstMapValue.put('fields', innerFieldsMap); // Put the inner fields map here
18
19// 2. Create an instance of the AdditionalFieldsMapValue wrapper for this item.
20ConnectApi.AdditionalFieldsMapValue firstMapValueWrapper = new ConnectApi.AdditionalFieldsMapValue();
21
22// 3. Assign the map data (created in step 1) to the *correct property* on the wrapper instance.
23firstMapValueWrapper.additionalFieldsMapValue = dataForFirstMapValue;
24
25
26// 4. Add the populated wrapper instance to the list.
27additionalFieldsValueList.add(firstMapValueWrapper);
28
29// --- End of Populating the First Item ---
30
31
32// --- If you need more items in the list, repeat steps 1-4 for each ---
33
34// Assign the populated additional object to the policyInput
35policyInput.additionalFields = additionalFieldsValueList;
36
37
38policyInput.insurancePolicy = insurancePolicy;
39
40// Optionally populate InsurancePolicyTransactionInputRepresentation
41ConnectApi.InsurancePolicyTransactionInputRepresentation transactionRecord = new ConnectApi.InsurancePolicyTransactionInputRepresentation();
42policyInput.transactionRecord = transactionRecord;
43
44// Optionally set the effective date
45// policyInput.effectiveDate = '2025-06-01';
46
47try {
48 // Call the Connect API directly
49 ConnectApi.PolicyOutputRepresentation policyData =
50 ConnectApi.InsurancePolicyAdminFamily.reinstatePolicy(policyInput, '0YTxx00000000MbGAI');
51
52 // Output the policy data to the debug log
53 System.debug('Policy reinstated successfully: ' + JSON.serializePretty(policyData));
54} catch (Exception e) {
55 // Log the error
56 System.debug('Error while reinstating policy: ' + e.getMessage());
57}