MSDN Library

CancelSalesOrder Message

banner art

Cancels a sales order.

The relevant classes are specified in the following table.

Type Class
Request CancelSalesOrderRequest
Response CancelSalesOrderResponse
Entity salesorder

Remarks

To perform this action, the caller must have access rights on the salesorder entity instance. For a list of required privileges, see CancelSalesOrder Privileges.

Example

The following code example demonstrates how to cancel a sales order.

[C#]
// Set up the CRM Service.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the orderclose activity Object
orderclose close = new orderclose();

// Set the orderclose Object's Properties
close.subject = "orderclose";

// Create a Lookup the salesorder being dropped
close.salesorderid = new Lookup();
close.salesorderid.type = EntityName.salesorder.ToString();
close.salesorderid.Value = created.id;

// Creates the Request Object
CancelSalesOrderRequest cancel = new CancelSalesOrderRequest();

// Set the Request Object's Properties
cancel.OrderClose = close;
cancel.Status = 0;

// Executes the Request
CancelSalesOrderResponse canceled = (CancelSalesOrderResponse) service.Execute(cancel);
[Visual Basic .NET]
' Set up the CRM Service.
Dim service AS CrmService = New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the orderclose activity Object
Dim close As New orderclose()

'Set the orderclose Object's Properties
close.subject = "orderclose"

'Create a Lookup the salesorder being dropped
close.salesorderid = New Lookup()
close.salesorderid.type = EntityName.salesorder.ToString()
close.salesorderid.Value = created.id

' Creates the Request Object
Dim cancel As New CancelSalesOrderRequest()

' Set the Request Object's Properties
cancel.OrderClose = close
cancel.Status = 0

' Executes the Request
Dim canceled As CancelSalesOrderResponse = CType(service.Execute(cancel), CancelSalesOrderResponse)

Related Topics

CrmService Messages


© 2007 Microsoft Corporation. All rights reserved.


Show:
© 2016 Microsoft