---
schema_version: "1"
id: 30f1a1109a803993d88d97a45e8c001058122c7f97c88c7e1b0f1fcc49474ce1
title: Create Insurance Quote Action
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/actions_obj_create_quote.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/actions_obj_create_quote.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 865474ad4d1d5cd5dfbaea43e8f8dd07afe83ee5eab58ac28efc5791bf7c04c3
description: Create an Insurance quote by using a context ID or a set of user inputs that represent quote details.
---
# Create Insurance Quote Action

Create an Insurance quote by using a context ID or a set of user inputs that represent quote details.

This action is available in API version 63.0 and later.

## Supported REST HTTP Methods

**URI**: /services/data/vXX.X/actions/standard/createInsuranceQuote

Where XX.X is the latest API version.

**Formats**: JSON

**HTTP Methods**: GET, POST

**Authentication**: Authorization: Bearer TOKEN

Where TOKEN is your OAuth access token.

## Inputs

If you specify quoteInputs (but not contextId) in the request body, you must provide quoteName, priceBookId, and effectiveDate as input parameters.

If you specify contextId (but not quoteInputs) in the request body, you must provide these:

- either quoteName or SalesTransactionName within additionalFields, and
- either priceBookId or PriceBook within additionalFields

| Input | Type | Description |
| --- | --- | --- |
| accountId | String | ID of the account that's associated with the quote being created. |
| additionalFields | String | Optional. Map of additional fields that must be updated in the quote context. |
| contextId | String | Required if quoteInputs isn't specified. Context ID that's used to issue the quote. |
| effectiveDate | Date | Date that the quote becomes effective. |
| expirationDate | Date | Optional. Expiration date of the quote. |
| opportunityId | String | Optional. ID of the opportunity that's associated with the quote. |
| pricebookId | String | Required if either quoteInputs or contextId is specified. ID of the pricebook that's associated with the quote. |
| pricingProcedureApiName | String | Optional. API name of the pricing procedure used to price the product. |
| quoteInputs | String | Required if contextId isn't specified. Set of user inputs on products that represent the quote details. |
| quoteOptions | Apex-defined | An Apex [runtime\_industries\_insurance.CreateInsuranceQuoteOptions](https://developer.salesforce.com/docs/atlas.en-us.264.0.insurance_developer_guide.meta/insurance_developer_guide/apex_class_runtime_industries_insurance_CreateInsuranceQuoteOptions.htm "HTML (New Window)") record that contains details to create the quote. |
| quoteName | String | Name of the quote that must be created. |
| ratingDate | Date | Optional. Date to find the active pricing procedure. |

## Outputs

<table class="featureTable sort_table" summary="">


          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d539608e347">Output</th>

              <th class="featureTableHeader  " id="d539608e350">Details</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d539608e347" data-title="Output"><span class="keyword parmname">contextId</span></td>

              <td class="entry" headers="d539608e350" data-title="Details">
                <strong class="ph b">Type</strong>
                <p class="p">String</p>
                <strong class="ph b">Description</strong>
                <p class="p">Context ID of the
                  insurance quote that's created.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d539608e347" data-title="Output"><span class="keyword parmname">quoteId</span></td>

              <td class="entry" headers="d539608e350" data-title="Details">
                <strong class="ph b">Type</strong>
                <p class="p">String</p>
                <strong class="ph b">Description</strong>
                <p class="p">ID of the insurance
                  quote that's created.</p>
              </td>

            </tr>

          </tbody>

        </table>

## Example

Sample request where quoteInputs is specified in the request body.

{
  "inputs":\[
    {
      "quoteName": "Auto Insurance Quote",
      "priceBookId" : "01sxx0000005pyfAAA",
      "accountId": "001xx000003GYwrAAG",
      "effectiveDate": "2024-10-11",
      "opportunityId": "006xx000001a2tbAAA",
      "quoteOptions": {
         "productSellingModel": "One Time",
         "saveQuote": true
      },
      "quoteInputs": "\[{"productCode":"autoRoot","instanceKeys":\["AutoRoot"\],"items":\[{"productCode":"autoBundle","instanceKeys":\["AutoRoot","AutoBundle"\],"attributes":{"avMake":"BMW"},"relatedRecords":\[{"relatedRecordId":"001xx000003GYwrAAG","relatedRecordObjName":"Account"}\]},{"productCode":"autoDriver","instanceKeys":\["AutoRoot","AutoBundle","AutoDriver"\],"relatedRecords":\[{"relatedRecordId":"003xx000004WhKhAAK","relatedRecordObjName":"Contact"}\]},{"productCode":"autoRental","instanceKeys":\["AutoRoot","AutoBundle","AutoRental"\]},{"productCode":"autoCollision","instanceKeys":\["AutoRoot","AutoBundle","autoCollision"\],"attributes":{"CollisionBasePremium":250,"autoCollDedClmCov":250}}\]}\]"
    }
  \]
}

    

This is a sample request to call this invocable action from Apex code.

// Sample Apex call for createInsuranceQuote invocable action
public class CreateInsuranceQuoteInvoke {
    private static final String ACTION\_NAME = 'createInsuranceQuote';

    public static Boolean invokeMethod(Map<String, Object> inputs, Map<String, Object> output) {
        if (output == null) {
            output = new Map<String, Object>();
        }

        try {
            Invocable.Action action = Invocable.Action.createStandardAction(ACTION\_NAME);

            // Required inputs (serialize where needed)
            setInvocationParameter(action, inputs, 'quoteInputs', true);
            setInvocationParameter(action, inputs, 'quoteName', false);
            setInvocationParameter(action, inputs, 'priceBookId', false);
            setInvocationParameter(action, inputs, 'accountId', false);
            setInvocationParameter(action, inputs, 'effectiveDate', false);

            // Optional inputs
            setInvocationParameter(action, inputs, 'contextId', false);
            setInvocationParameter(action, inputs, 'expirationDate', false);
            setInvocationParameter(action, inputs, 'additionalFields', true);
            setInvocationParameter(action, inputs, 'opportunityId', false);

            // quoteOptions is optional but supported
            if (inputs != null && inputs.containsKey('quoteOptions')) {
                Map<String, Object> optionsFromInput =
                    (Map<String, Object>) inputs.get('quoteOptions');
                if (optionsFromInput != null) {
                    runtime\_industries\_insurance.CreateInsuranceQuoteOptions quoteOptions =
                        new runtime\_industries\_insurance.CreateInsuranceQuoteOptions();
                    if (optionsFromInput.containsKey('executePricing')) {
                        quoteOptions.executePricing =
                            (Boolean) optionsFromInput.get('executePricing');
                    }
                    if (optionsFromInput.containsKey('validateProductCatalog')) {
                        quoteOptions.validateProductCatalog =
                            (Boolean) optionsFromInput.get('validateProductCatalog');
                    }
                    if (optionsFromInput.containsKey('executeConfigurationRules')) {
                        quoteOptions.executeConfigurationRules =
                            (Boolean) optionsFromInput.get('executeConfigurationRules');
                    }
                    if (optionsFromInput.containsKey('executeQualificationRules')) {
                        quoteOptions.executeQualificationRules =
                            (Boolean) optionsFromInput.get('executeQualificationRules');
                    }
                    if (optionsFromInput.containsKey('saveQuote')) {
                        quoteOptions.saveQuote =
                            (Boolean) optionsFromInput.get('saveQuote');
                    }
                    if (optionsFromInput.containsKey('productSellingModel')) {
                        quoteOptions.productSellingModel =
                            (String) optionsFromInput.get('productSellingModel');
                    }
                    action.setInvocationParameter('quoteOptions', quoteOptions);
                }
            }

            List<Invocable.Action.Result> results = action.invoke();
            if (results != null && !results.isEmpty() && results\[0\].isSuccess()) {
                output.put('output', results\[0\].getOutputParameters());
                output.put('success', true);
                return true;
            }

            output.put('success', false);
            if (results != null && !results.isEmpty()) {
                output.put('errors', results\[0\].getErrors());
            }
            return false;
        } catch (Exception e) {
            output.put('success', false);
            output.put('errorMessage', e.getMessage());
            return false;
        }
    }

    private static void setInvocationParameter(
        Invocable.Action action,
        Map<String, Object> payload,
        String attribute,
        Boolean serializeJson
    ) {
        if (payload != null && payload.containsKey(attribute) && payload.get(attribute) != null) {
            if (serializeJson) {
                action.setInvocationParameter(attribute, JSON.serialize(payload.get(attribute)));
            } else {
                action.setInvocationParameter(attribute, payload.get(attribute));
            }
        }
    }
}

Sample Response

\[
  {
    "actionName": "createInsuranceQuote",
    "errors": null,
    "invocationId": null,
    "isSuccess": true,
    "outcome": null,
    "outputValues": {
      "contextId": "0000000i18tq18g00291753491065771466a599fe8a2440890b4f3d8b4ef40b5",
      "quoteId": "0Q0SG000000OOUD0A4"
    },
    "sortOrder": -1,
    "version": 1
  }
\]