Table of Contents

API - Sales Orders

This is a fork of page 30028 "APIV2 - Sales Orders" from version 27.0.38460.40573. Added support for Extra Values.

Object Definition

Object TypePage
Object ID70314152
Object NameQWESR API - Sales Orders
Source TableSales Order Entity Buffer

API Definition

APIPublishersmartApps
APIGroupspider
APIVersionv1.0
EntitySetNamesalesOrders
EntityNamesalesOrder

Service Enabled Procedures

Name Description
Release(WebServiceActionContext) Releases the current Sales Order.
Reopen(WebServiceActionContext) Reopens the current Sales Order.
ShipAndInvoice(WebServiceActionContext) Ships and Invoices the current Order.

Events

Name Description
OnAfterInsert(Record "Sales Order Entity Buffer"; Record "Sales Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text; List of [Integer]) Raised after a record is inserted.
OnAfterModify(Record "Sales Order Entity Buffer"; Record "Sales Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text; List of [Integer]) Raised after a record is modified.
OnGetExtraValues(Record "Sales Order Entity Buffer"; Record "Sales Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text) Raised after a record is read from the database. Makes it possible to set the ExtraValues 1..10, to be returned to the client.

Example

Read

Get a list of Sales Orders.

GET businesscentralPrefix/companies({id})/salesOrders?$schemaversion=2.0

Get a single Sales Order and it's lines.

GET businesscentralPrefix/companies({id})/salesOrders({id})?$expand=salesOrderLines&$schemaversion=2.0

Create

Create a new Sales Order and a Sales Order Line.

POST businesscentralPrefix/companies({id})/salesOrders?$expand=salesOrderLines&$schemaversion=2.0
Content-type: application/json
{
   "customerNumber": "10000",
   "salesOrderLines": [
       {
           "lineType": "Item",
           "lineObjectNumber": "1896-S",
           "quantity": 5
   	    }
   ]
}

Update

Set the field "discountAmount" on a Sales Order. In Business Central the Invoice Discount is distributed to all Sales Order Lines. To be able to set discountAmount, all Sales Order Lines must be added first, then do a PATCH to set discountAmount.

PATCH businesscentralPrefix/companies({id})/salesOrders({id from the POST response})?$schemaversion=2.0
If-Match: {@odata.etag from the POST response}
Content-Type: application/json
{
    "discountAmount": 10
}

Controls

Type Name Data Type Read-only
Field id Yes
Field number Yes
Field externalDocumentNumber
Field orderDate
Field postingDate
Field customerId
Field customerNumber
Field customerName Yes
Field billToName Yes
Field billToCustomerId
Field billToCustomerNumber
Field shipToName
Field shipToContact
Field sellToAddressLine1
Field sellToAddressLine2
Field sellToCity
Field sellToCountry
Field sellToState
Field sellToPostCode
Field billToAddressLine1 Yes
Field billToAddressLine2 Yes
Field billToCity Yes
Field billToCountry Yes
Field billToState Yes
Field billToPostCode Yes
Field shipToAddressLine1
Field shipToAddressLine2
Field shipToCity
Field shipToCountry
Field shipToState
Field shipToPostCode
Field shortcutDimension1Code
Field shortcutDimension2Code
Field currencyId
Field currencyCode Text
Field pricesIncludeTax
Field paymentTermsId
Field shipmentMethodId
Field salesperson
Field partialShipping Boolean
Field requestedDeliveryDate
Sub page dimensionSetLines
Sub page salesOrderLines
Sub page pdfDocument Yes
Field discountAmount
Field discountAppliedBeforeTax Yes
Field totalAmountExcludingTax Yes
Field totalTaxAmount Yes
Field totalAmountIncludingTax Yes
Field fullyShipped
Field status Yes
Field lastModifiedDateTime Yes
Field phoneNumber
Field email
Field extraValue1 Text
Field extraValue2 Text
Field extraValue3 Text
Field extraValue4 Text
Field extraValue5 Text
Field extraValue6 Text
Field extraValue7 Text
Field extraValue8 Text
Field extraValue9 Text
Field extraValue10 Text
Sub page attachments
Sub page documentAttachments

This documentation is generated from Spider v27.4