CloseQuoteRequest Class

Definition

Contains the data that is needed to close a quote.

public ref class CloseQuoteRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class CloseQuoteRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type CloseQuoteRequest = class
    inherit OrganizationRequest
Public NotInheritable Class CloseQuoteRequest
Inherits OrganizationRequest
Inheritance
CloseQuoteRequest
Attributes

Examples

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface instance.

/// <summary>
/// Demonstrates the CloseQuote message
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="opportunityId">The ID of an opportunity to generate a quote from.</param>
static void CloseQuoteExample(IOrganizationService service, Guid opportunityId)
{
      // Convert the opportunity to a quote
      GenerateQuoteFromOpportunityRequest genQuoteFromOppRequest = new()
      {
         OpportunityId = opportunityId,
         ColumnSet = new ColumnSet("quoteid", "name")
      };
      var genQuoteFromOppResponse = (GenerateQuoteFromOpportunityResponse)
         service.Execute(genQuoteFromOppRequest);

      Entity quoteToClose = genQuoteFromOppResponse.Entity;

      // Activate the quote
      Entity closeQuoteUpdate = new("quote")
      {
         Id = quoteToClose.Id,
         Attributes = {
            // Active
            { "statecode", new OptionSetValue(1) },
            // In Progress
            { "statuscode", new OptionSetValue(2) }
         }
      };

      service.Update(closeQuoteUpdate);

      // Close the quote
      CloseQuoteRequest request = new()
      {
         QuoteClose = new Entity("quoteclose")
         {
            Attributes = {
                  {"quoteid", quoteToClose.ToEntityReference() },
                  {"subject", "Quote Close " + DateTime.Now.ToString()}
            }
         },
         Status = new OptionSetValue(-1)
      };

      service.Execute(request);
}

For a complete example see Sample: Process quotes, sales orders and invoices

Remarks

This message requires Dynamics 365 Sales.

For the Web API use the CloseQuote action.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of CloseQuoteResponse.

Privileges and Access Rights

To perform this action, the caller must have privileges on the Quote entity.

The caller must have the following privileges:

  • prvCreateActivity
  • prvAppendToQuote
  • prvAppendActivity
  • prvWriteQuote

Constructors

CloseQuoteRequest()

Initializes a new instance of the CloseQuoteRequest class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
QuoteClose

Gets or sets a quote to be closed. Required.

RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
Status

Gets or sets a status of the quote. Required.

Applies to

See also