Create a Quote Invocable Action

Create an enterprise quote for an existing opportunity, or create an opportunity and its quote together in one request.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions

Available from the Salesforce REST Actions API, Flow Builder, and OmniStudio in API version 68.0 and later, this synchronous action calls the ESM_CreateQuote Integration Procedure. Specify an existing opportunity ID, or provide the required opportunity values to create an opportunity.

Note
Note To configure this invocable action as an Agentic action in Agentforce, use wrappers for both input and output payload transformation. You can create the wrappers in Apex or in Flow.

Input Values

Parameter Required Description Data Type
accountId Yes The ID of the account for the quote. String
quoteName Yes The name of the quote. String
priceList Yes The ID of the price list to use for the quote. String
opportunityId No The ID of an existing opportunity. If this value is blank, the action creates an opportunity. String
opportunityName Conditional The name of the new opportunity. Required when opportunityId is blank. String
opportunityCloseDate Conditional The close date of the new opportunity in yyyy-MM-dd format. Required when opportunityId is blank. Date
opportunityStage Conditional The stage of the new opportunity. Required when opportunityId is blank. String

Output Values

Parameter Description Data Type
quoteId The ID of the created quote. String
opportunityId The ID of the opportunity associated with the quote. String
error An error message if the quote couldn't be created. String

Usage

Use this action to create a quote for an existing opportunity or to create a new opportunity and quote together.

To use an existing opportunity, specify opportunityId. To create an opportunity, omit opportunityId and specify opportunityName, opportunityCloseDate, and opportunityStage.

The action returns its result synchronously.

Considerations

  • The running user must have access to the record.
  • When opportunityId is blank, all three new-opportunity inputs are required.
  • Business and validation failures are returned in outputValues.error, even when the Actions API envelope contains isSuccess=true.
  • Inputs and outputs are positional when a request contains multiple input objects.

Example Input

{
  "inputs": [
    {
      "accountId": "001XXXXXXXXXXXXXXX",
      "quoteName": "Acme Enterprise Q1 Quote",
      "priceList": "Enterprise Price List",
      "opportunityId": "006XXXXXXXXXXXXXXX"
    }
  ]
}

Example Output

[
  {
    "actionName": "vlocity_cmt__B2BCmexCreateQuoteInvocable",
    "isSuccess": true,
    "errors": null,
    "outputValues": {
      "quoteId": "0Q0XXXXXXXXXXXXXXX",
      "opportunityId": "006XXXXXXXXXXXXXXX",
      "error": null
    }
  }
]

Error Handling

Check outputValues.error to determine whether the action succeeded. Business and validation failures don't populate the Actions API errors array.

The action returns an error when a required value is blank. If the Integration Procedure doesn't return a quote ID, the action reports that the quote ID couldn't be extracted from the response.

An access failure returns the following message:

Looks like you don't have access to this record. Your Salesforce admin can help with that.