---
schema_version: "1"
id: 8a7a5508f532b42511fa5f5fb216ec4aed716b1f93d952ada16c0e056ca13816
title: postInsuranceCreateQuoteFromContract(createQuoteFromContractInputParam, contractId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceGroupBenefitsFamily_postInsuranceCreateQuoteFromContract.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceGroupBenefitsFamily_postInsuranceCreateQuoteFromContract.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9d960042f69595aed6e1841b9f0308b4910944cab37aba2b013de64a26cc203a
description: Create a quote from an existing insurance contract, including the quote structure and line items.
---
# 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](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_insurance_create_quote_from_contract.htm "Input representation for creating a quote from an existing insurance contract.")
- 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.

## Return Value

Type: [ConnectApi.InsuranceCreateQuoteFromContractOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_create_quote_from_contract_output.htm "Output representation returned when creating a quote from an existing insurance contract.")

## 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.

// Create a quote from an existing contract.

final String CONTRACT\_ID = '800SB00001IhQijYAF';

// Optional: field overrides for Quote / QuoteLineItem.
ConnectApi.InsuranceApexStringRepresentation field =
    new ConnectApi.InsuranceApexStringRepresentation();
field.key = 'PlanAllocationType\_\_std';
field.value = 'Restrictive';

ConnectApi.InsuranceQuoteItem quoteItem = new ConnectApi.InsuranceQuoteItem();
quoteItem.entity = 'QuoteLineItem';
quoteItem.productPath = 'ciBasic';
quoteItem.fields = new List<ConnectApi.InsuranceApexStringRepresentation>{ field };

// Optional: configuration and qualification rules.
ConnectApi.InsGBQuoteConfigOptions configOptions = new ConnectApi.InsGBQuoteConfigOptions();
configOptions.executeConfigurationRules = false;
configOptions.executeQualificationRules = false;

ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation input =
    new ConnectApi.InsuranceCreateQuoteFromContractInputRepresentation();
input.quoteName = 'Apex Generated Quote';
input.transactionType = 'GB Endorsement';   // e.g. GB Endorsement, GB Renewal
input.insuranceQuoteType = 'GroupRenewal';  // e.g. Endorsement, Renewal
input.eventEffectiveFromDate = '2027-09-01';   // yyyy-MM-dd
input.eventEffectiveToDate = '2028-08-31';     // yyyy-MM-dd
input.groupCensusId = '0rfSB0000004eA9YAI';
// input.ratingDate = '2026-09-01';
// input.censusRatingType = 'Member Based';   // e.g. Member Based, Summary Based
input.configOptions = configOptions;
input.additionalFields = new List<ConnectApi.InsuranceQuoteItem>{ quoteItem };

try {
    ConnectApi.InsuranceCreateQuoteFromContractOutputRepresentation result =
        ConnectApi.InsuranceGroupBenefitsFamily.postInsuranceCreateQuoteFromContract(input, CONTRACT\_ID);

    System.debug('isSuccess: ' + result.isSuccess);
    System.debug('quoteId: ' + result.quoteId);
    System.debug('message: ' + result.message);
    System.debug('errors: ' + result.errors);
} catch (Exception e) {
    System.debug('Error while creating a quote from the contract: ' + e.getMessage());
}