Sales Order Document Service
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The Microsoft Dynamics AX sales order service enables external systems to read, create, update, and delete sales orders. You can configure the sales order service on an inbound or an outbound port to expose the following service operations:
Service Operation |
Input |
Entity Key Returned |
---|---|---|
create |
Values in the AxdSalesOrder object |
Value for SalesTable.SalesID |
delete |
Value for SalesTable.SalesID |
Nothing is returned. |
find |
Values for the AifQueryCriteria object |
AxdSalesOrder document object |
findKeys |
Values in the AifQueryCriteria object |
Value for SalesTable.SalesID |
read |
Value for SalesTable.SalesID |
AxdSalesOrder document object |
update |
Value for SalesTable.SalesID |
Nothing is returned. |
getKeys |
Values in the AifDocumentPaging object |
Value for SalesTable.SalesID |
getChangedKeys |
Values in the AifDocumentPaging object |
Value for SalesTable.SalesID |
For more information about document service operations, see Document Class Service Operations.
AIF Parameter Settings
You configure Application Integration Framework (AIF) parameter settings for the sales order service and the related free text invoice and picking list services on the Accounts receivable parameters form. To view this form, click Accounts receivable > Setup > Parameters and then click AIF.
The following sections describe the AIF parameter settings for sales order documents.
Sales Order - Order Type
Select the default location (journal or sales order) of inbound sales order documents.
Sales Order - Calculate Multiline Discount
Select this check box to calculate and apply the multiline discount for sales orders when creating or updating sales orders by using an AIF service.
Sales Order - Calculate Total Discount
Select this check box to calculate and apply the total discount for sales orders when creating or updating sales orders by using an AIF service.
Parameter Settings for Receiving Notes
Only documents of type Note can be included with sales orders.
The setting for the type of document is global for all integration ports. To set document management parameters for an organization, click Organization administration > Setup > Document management > Document management parameters and then click AIF.
The following sections describe the AIF parameter settings for inbound documents, including sales order documents.
General – Document Type
Select the document type for notes in incoming electronic documents. For sales orders, this type must be Note.
Note
The information in this field is maintained in the Document types form. For more information, see About print management document types and modules.
Document file service – Submit document files to workflow
Select this check box if the web service document files should be submitted to workflow for routing to appropriate parties.
Related Classes
The following objects are associated with the sales order service.
Object |
Description |
---|---|
Service class |
|
External service name |
SalesOrderService |
Axd <Document> class |
|
Ax <Table> classes |
|
Query |
AxdSalesOrder |
Restrictions
If you call the create method and try to create a sales order with the same SalesTable.CustAccount and SalesTable.PurchOrderFormNum values as another sales order, a new sales order is automatically created that has an order type (field SalesTable.SalesType) of Journal.
Document Limitations
Only inbound sales orders of type Sales Order and Journal are valid. The sales order document structure does not support the following types of sales orders:
Returned items
Item requirements
Subscription orders
Blanket orders
Project orders
Document Data Sources
Note Field Handling
The following relations between the DocuRef table and other tables must be respected when you integrate sales order documents.
Adding Notes to the Inbound Sales Order Header
DocuRef.RefRecId = SalesTable.RecId
DocuRef.RefTableId = SalesTable.TableId
DocuRef.RefCompanyID = SalesTable.DataAreaId
DocuRef.Restriction = "Internal"
CustFormLetterDocuments.DocuOnPurchOrder = "Header" or "All"
Only notes of type Note are valid on inbound sales order documents. If the sales order document contains notes of any other type, then the value in the Document management parameters form is used.
Adding Notes to the Inbound Sales Order Lines
DocuRef.RefRecId = SalesLine.RecId
DocuRef.RefTableId = SalesLine.TableId
DocuRef.RefCompanyID = SalesLine.DataAreaId
DocuRef.TypeId = CustFormLetterDocuments.DocuTypePackingSlip
DocuRef.Restriction = "Internal"
CustFormLetterDocuments.DocuOnPurchOrder = "Lines" or "All"
Only notes of type Note are valid on inbound sales order documents. If the sales order document contains notes of any other type, then the value in the Document management parameters form is used.
Required Fields
For a sales order document to be a valid business document, the following fields must contain a valid value. Validation of the required fields is performed by the business logic in the Ax <Table> classes.
SalesTable.CustAccount
SalesTable.DeliveryDate (defaults to today's date)
Note
If the delivery date control configuration key (SalesDeliveryDateControl) is enabled, then you must set the value for SalesTable.ReceiptDateRequested instead of SalesTable.DeliveryDate. For more information about the delivery date control configuration key, see Delivery date control configuration key (SalesDeliveryDateControl).
SalesTable.PurchOrderFormNum
Item line (there must be at least one item line)
SalesLine.ItemId
SalesLine.QtyOrdered
SalesLine.SalesUnit
The MarkupTrans.MarkupCode field is mandatory if miscellaneous changes are added to the sales order.
Security Settings
The sales order document supports role-based security as implemented by AIF. For more information, see About role-based security in services and AIF.
Sales Order ID
The sales order ID follows the same restrictions and rules that apply for manually created sales orders. Typically, the sales order ID should not be supplied in the inbound XML document. However, AIF can accept a sales order ID directly from an XML document if the sales order number sequence in Microsoft Dynamics AX is set up to accept manual sales order ID entries.
If the sales order number sequence is set up to use a default number sequence and an inbound XML document contains a sales order ID value, the entire document will be rejected.