postInsuranceIssueContract(issueContractInputParam)

Issue a group benefits contract from a quote synchronously to activate coverage.

API Version

68.0

Requires Chatter

No

Signature

public static ConnectApi.InsuranceIssueContractRepresentation postInsuranceIssueContract(ConnectApi.InsuranceIssueContractInputRepresentation issueContractInputParam)

Parameters

issueContractInputParam
Type: ConnectApi.InsuranceIssueContractInputRepresentation
Quote ID and optional contract dates, term, transaction detail level, and additional fields used to issue the contract.

Usage

Use this method to issue a group benefits contract from a quote synchronously. Specify the quote in quoteId.

To override dates derived from the quote, set contractStartDate and contractEndDate in yyyy-MM-dd format, or set contractTerm in months. Set transactionDetailLevel to PLAN_LEVEL, COVERAGE_LEVEL, or CHARGE_LEVEL. The default value is PLAN_LEVEL.

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 is a sample example that shows how to issue a contract from a quote, overrides the contract dates, sets plan-level transaction detail, and applies an enrollment start date on the insurance contract from Apex code.

1// Issue a group benefits contract from a quote.
2
3final String SOURCE_QUOTE_ID = '0Q0SB000000w6zV0AQ';
4
5// Optional: additional fields for Contract / InsuranceContract / ContractGroupPlan.
6ConnectApi.InsuranceApexStringRepresentation enrollmentStart =
7    new ConnectApi.InsuranceApexStringRepresentation();
8enrollmentStart.key = 'EnrollmentStartDate';
9enrollmentStart.value = '2026-09-01';
10
11ConnectApi.InsuranceContractItem insuranceContractItem = new ConnectApi.InsuranceContractItem();
12insuranceContractItem.entity = 'InsuranceContract';
13// insuranceContractItem.productPath = 'Health/Dental';
14insuranceContractItem.fields = new List<ConnectApi.InsuranceApexStringRepresentation>{
15    enrollmentStart
16};
17
18ConnectApi.InsuranceIssueContractInputRepresentation input =
19    new ConnectApi.InsuranceIssueContractInputRepresentation();
20input.quoteId = SOURCE_QUOTE_ID;
21input.contractStartDate = '2026-09-01';       // optional; yyyy-MM-dd
22input.contractEndDate = '2027-08-31';         // optional; yyyy-MM-dd
23// input.contractTerm = 12;                   // optional
24input.transactionDetailLevel = 'PLAN_LEVEL';  // optional; PLAN_LEVEL | COVERAGE_LEVEL | CHARGE_LEVEL
25input.additionalFields = new List<ConnectApi.InsuranceContractItem>{ insuranceContractItem };
26
27try {
28    ConnectApi.InsuranceIssueContractRepresentation result =
29        ConnectApi.InsuranceGroupBenefitsFamily.postInsuranceIssueContract(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 issuing the contract: ' + e.getMessage());
37}