postInsuranceCreateQuoteFromContract(createQuoteFromContractInputParam, contractId)

Create a quote from an existing insurance contract, including the quote structure and line items.

API Version

67.0

Requires Chatter

No

Signature

public static ConnectApi.InsuranceCreateQuoteFromContractOutputRepresentation postInsuranceCreateQuoteFromContract(ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation createQuoteFromContractInputParam, String contractId)

Parameters

createQuoteFromContractInputParam
Type: ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation
Input details used to create the quote from the contract, including effective dates, transaction type, census information, and optional configuration options.
contractId
Type: String
ID of the insurance contract used to create the quote.

Usage

Use this method to create a quote from an existing insurance contract, including the quote structure and line items. Specify the contract in contractId. All properties on the input representation are optional.

Set quoteName, transactionType (such as GB Endorsement or GB Renewal), and insuranceQuoteType (such as Endorsement or Renewal) on the quote. Use eventEffectiveFromDate and eventEffectiveToDate in yyyy-MM-dd format. Associate a census with groupCensusId.

To apply field overrides to Quote or QuoteLineItem, add items to additionalFields. Each item identifies the entity, optional productPath, and fields as key-value pairs. Set configOptions to control whether configuration and qualification rules run.

Check isSuccess and quoteId on the response. Errors are in the errors property.

Example

This example creates a quote from an existing contract. It sets quote name, transaction type, effective dates, and census, and it applies an optional line-item field override.

1// Create a quote from an existing contract.
2
3final String CONTRACT_ID = '800SB00001IhQijYAF';
4
5// Optional: field overrides for Quote / QuoteLineItem.
6ConnectApi.InsuranceApexStringRepresentation field =
7    new ConnectApi.InsuranceApexStringRepresentation();
8field.key = 'PlanAllocationType__std';
9field.value = 'Restrictive';
10
11ConnectApi.InsuranceQuoteItem quoteItem = new ConnectApi.InsuranceQuoteItem();
12quoteItem.entity = 'QuoteLineItem';
13quoteItem.productPath = 'ciBasic';
14quoteItem.fields = new List<ConnectApi.InsuranceApexStringRepresentation>{ field };
15
16// Optional: configuration and qualification rules.
17ConnectApi.InsGBQuoteConfigOptions configOptions = new ConnectApi.InsGBQuoteConfigOptions();
18configOptions.executeConfigurationRules = false;
19configOptions.executeQualificationRules = false;
20
21ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation input =
22    new ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation();
23input.quoteName = 'Apex Generated Quote';
24input.transactionType = 'GB Endorsement';   // e.g. GB Endorsement, GB Renewal
25input.insuranceQuoteType = 'GroupRenewal';  // e.g. Endorsement, Renewal
26input.eventEffectiveFromDate = '2027-09-01';   // yyyy-MM-dd
27input.eventEffectiveToDate = '2028-08-31';     // yyyy-MM-dd
28input.groupCensusId = '0rfSB0000004eA9YAI';
29// input.ratingDate = '2026-09-01';
30// input.censusRatingType = 'Member Based';   // e.g. Member Based, Summary Based
31input.configOptions = configOptions;
32input.additionalFields = new List<ConnectApi.InsuranceQuoteItem>{ quoteItem };
33
34try {
35    ConnectApi.InsuranceCreateQuoteFromContractOutputRepresentation result =
36        ConnectApi.InsuranceGroupBenefitsFamily.postInsuranceCreateQuoteFromContract(input, CONTRACT_ID);
37
38    System.debug('isSuccess: ' + result.isSuccess);
39    System.debug('quoteId: ' + result.quoteId);
40    System.debug('message: ' + result.message);
41    System.debug('errors: ' + result.errors);
42} catch (Exception e) {
43    System.debug('Error while creating a quote from the contract: ' + e.getMessage());
44}