CancelSalesOrderRequest CancelSalesOrderRequest CancelSalesOrderRequest CancelSalesOrderRequest Class

Definition

Contains the data that is needed to cancel a sales order (order).

For the Web API use the CancelSalesOrder Action.

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

Examples



// Define columns to be retrieved after creating the order
salesOrderColumns = new ColumnSet("salesorderid", "totalamount");

// Convert the quote to a sales order
var =
    new ConvertQuoteToSalesOrderRequest()
    {
        QuoteId = _quoteId,
        ColumnSet = salesOrderColumns
    };

convertQuoteResponse = (ConvertQuoteToSalesOrderResponse)svc.Execute(convertQuoteRequest);
SalesOrder closeSalesOrder = (SalesOrder)convertQuoteResponse.Entity;
_closeSalesOrderId = closeSalesOrder.Id;

var cancelRequest = new CancelSalesOrderRequest()
{
    OrderClose = new OrderClose()
    {
        SalesOrderId = closeSalesOrder.ToEntityReference(),
        Subject = "Close Sales Order " + DateTime.Now
    },
    Status = new OptionSetValue(-1)
};
svc.Execute(cancelRequest);
Console.WriteLine("Canceled sales order");

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. For the complete sample, see the link later in this topic.

BusinessManagement#CancelSalesOrder

Remarks

Message Availability

This message works regardless whether the caller is connected to the server or offline.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges on the SalesOrder entity. For a complete list of the required privileges, see CancelSalesOrder message privileges.

Constructors

CancelSalesOrderRequest() CancelSalesOrderRequest() CancelSalesOrderRequest() CancelSalesOrderRequest()

Initializes a new instance of the CancelSalesOrderRequest class.

Properties

ExtensionData ExtensionData ExtensionData ExtensionData

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

(Inherited from OrganizationRequest)
Item[String] Item[String] Item[String] Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
OrderClose OrderClose OrderClose OrderClose

Gets or sets the close activity that is associated with the sales order (order) that you want to cancel. Required.

Parameters Parameters Parameters Parameters

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

(Inherited from OrganizationRequest)
RequestId RequestId RequestId RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional.

(Inherited from OrganizationRequest)
RequestName RequestName RequestName RequestName

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

(Inherited from OrganizationRequest)
Status Status Status Status

Gets or sets the status of the sales order (order). Required.

Applies to

See also