Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Retrieves a list of sales order summary objects that match the specified criteria.
Parameters
Parameter |
Type |
Description |
|---|---|---|
criteria |
A sales order criteria object that specifies which sales order summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetSalesOrderListResult |
The list of sales order summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Sales
Examples
The following C# example retrieves the list of sales order summary objects where the CustomerKey value is equal to "AARONFIT0001" and the TransactionState property is equal to "Work". The Id and TotalAmount property from each sales order summary object is displayed in a message box.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfString customerIdRestriction;
ListRestrictionOfNullableOfSalesTransactionState transactionStateRestriction;
SalesOrderCriteria salesOrderCriteria;
SalesOrderSummary[] salesOrderSummary;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create a customer restriction object
// Specify the customer ID
customerIdRestriction = new LikeRestrictionOfString();
customerIdRestriction.EqualValue = "AARONFIT0001";
// Create a transaction state restriction object
// The SaleTransactionState enumeration specifies the transaction state
transactionStateRestriction = new ListRestrictionOfNullableOfSalesTransactionState();
transactionStateRestriction.EqualValue = SalesTransactionState.Work;
// Create a sales order criteria object
// Retrieve summary objects of active sales orders for the specified customer
salesOrderCriteria = new SalesOrderCriteria();
salesOrderCriteria.TransactionState = transactionStateRestriction;
salesOrderCriteria.CustomerId = customerIdRestriction;
// Retrieve the sales order summaries specified by the criteria object
salesOrderSummary = wsDynamicsGP.GetSalesOrderList(salesOrderCriteria, context);
// Display the ID and amount of each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (SalesOrderSummary a in salesOrderSummary)
{
summaryList.AppendLine("Order number: " + a.Key.Id + " Order amount: " +
a.TotalAmount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfstring customerIdRestriction;
ListRestrictionOfNullableOfSalesTransactionState transactionStateRestriction;
SalesOrderCriteria salesOrderCriteria;
SalesOrderSummary[] salesOrderSummary;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create a customer restriction object
// Specify the customer ID
customerIdRestriction = new LikeRestrictionOfstring();
customerIdRestriction.EqualValue = "AARONFIT0001";
// Create a transaction state restriction object
// The SaleTransactionState enumeration specifies the transaction state
transactionStateRestriction = new ListRestrictionOfNullableOfSalesTransactionState();
transactionStateRestriction.EqualValue = SalesTransactionState.Work;
// Create a sales order criteria object
// Retrieve summary objects of active sales orders for the specified customer
salesOrderCriteria = new SalesOrderCriteria();
salesOrderCriteria.TransactionState = transactionStateRestriction;
salesOrderCriteria.CustomerId = customerIdRestriction;
// Retrieve the sales order summaries specified by the criteria object
salesOrderSummary = wsDynamicsGP.GetSalesOrderList(salesOrderCriteria, context);
// Display the ID and amount of each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (SalesOrderSummary a in salesOrderSummary)
{
summaryList.AppendLine("Order number: " + a.Key.Id + " Order amount: " +
a.TotalAmount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}