postInsuranceContractRenewal(contractRenewalInputParam)

Create a renewed-term group benefits contract from a quote.

API Version

68.0

Requires Chatter

No

Signature

public static ConnectApi.InsuranceContractRenewalRepresentation postInsuranceContractRenewal(ConnectApi.InsuranceContractRenewalInputRepresentation contractRenewalInputParam)

Parameters

contractRenewalInputParam
Type: ConnectApi.InsuranceContractRenewalInputRepresentation
Quote ID, renewal date, optional contract end date and term, and additional fields used to create the renewed contract.

Usage

Use this method to create a renewed insurance contract from a renewal quote. The method carries forward applicable contract details and line items for the next coverage term. Specify the quote in quoteId and the start of the renewed term in renewalDate using yyyy-MM-dd format.

To set the end of the renewed term, use contractEndDate in yyyy-MM-dd format, or set contractTerm in months. The default term is 12 months.

To stamp additional fields on Contract, InsuranceContract, or ContractGroupPlan, add items to additionalFields. For a contract group plan, set productPath to identify where in the product hierarchy the fields apply.

This method runs synchronously. Check isSuccess and contractId on the response. Errors are in the errors property.

Example

This example creates a renewed-term contract from a quote, sets the renewal date, and stamps an enrollment start date on the insurance contract.

1// Create a renewed-term contract from a quote.
2
3final String SOURCE_QUOTE_ID = '0Q0xx0000004C92CAE';
4final String RENEWAL_DATE = '2027-01-01';   // yyyy-MM-dd
5
6// Optional: additional fields for Contract / InsuranceContract / ContractGroupPlan.
7ConnectApi.InsuranceApexStringRepresentation enrollmentStart =
8    new ConnectApi.InsuranceApexStringRepresentation();
9enrollmentStart.key = 'EnrollmentStartDate';
10enrollmentStart.value = '2027-01-01';
11
12ConnectApi.InsuranceContractItem insuranceContractItem = new ConnectApi.InsuranceContractItem();
13insuranceContractItem.entity = 'InsuranceContract';
14// insuranceContractItem.productPath = 'Health/Dental';
15insuranceContractItem.fields = new List<ConnectApi.InsuranceApexStringRepresentation>{
16    enrollmentStart
17};
18
19ConnectApi.InsuranceContractRenewalInputRepresentation input =
20    new ConnectApi.InsuranceContractRenewalInputRepresentation();
21input.quoteId = SOURCE_QUOTE_ID;
22input.renewalDate = RENEWAL_DATE;
23// input.contractTerm = 12;                    // optional; term in months
24// input.contractEndDate = '2027-12-31';       // optional; yyyy-MM-dd
25input.additionalFields = new List<ConnectApi.InsuranceContractItem>{ insuranceContractItem };
26
27try {
28    ConnectApi.InsuranceContractRenewalRepresentation result =
29        ConnectApi.InsuranceGroupBenefitsFamily.postInsuranceContractRenewal(input);
30
31    System.debug('isSuccess: ' + result.isSuccess);
32    System.debug('contractId: ' + result.contractId);
33    System.debug('message: ' + result.message);
34    System.debug('errors: ' + result.errors);
35} catch (Exception e) {
36    System.debug('Error while renewing the contract: ' + e.getMessage());
37}