Show / Hide Table of Contents

    API - Sales Orders

    This is a fork of page 30028 "APIV2 - Sales Orders" from version 23.3.14876.15704. 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 Guid Yes
    Field number Code[20] Yes
    Field externalDocumentNumber Code[35]
    Field orderDate Date
    Field postingDate Date
    Field customerId Guid
    Field customerNumber Code[20]
    Field customerName Text[100] Yes
    Field billToName Text[100] Yes
    Field billToCustomerId Guid
    Field billToCustomerNumber Code[20]
    Field shipToName Text[100]
    Field shipToContact Text[100]
    Field sellToAddressLine1 Text[100]
    Field sellToAddressLine2 Text[50]
    Field sellToCity Text[30]
    Field sellToCountry Code[10]
    Field sellToState Text[30]
    Field sellToPostCode Code[20]
    Field billToAddressLine1 Text[100] Yes
    Field billToAddressLine2 Text[50] Yes
    Field billToCity Text[30] Yes
    Field billToCountry Code[10] Yes
    Field billToState Text[30] Yes
    Field billToPostCode Code[20] Yes
    Field shipToAddressLine1 Text[100]
    Field shipToAddressLine2 Text[50]
    Field shipToCity Text[30]
    Field shipToCountry Code[10]
    Field shipToState Text[30]
    Field shipToPostCode Code[20]
    Field shortcutDimension1Code Code[20]
    Field shortcutDimension2Code Code[20]
    Field currencyId Guid
    Field currencyCode Text
    Field pricesIncludeTax Boolean
    Field paymentTermsId Guid
    Field shipmentMethodId Guid
    Field salesperson Code[20]
    Field partialShipping Boolean
    Field requestedDeliveryDate Date
    Sub page dimensionSetLines
    Sub page salesOrderLines
    Field discountAmount Decimal
    Field discountAppliedBeforeTax Boolean Yes
    Field totalAmountExcludingTax Decimal Yes
    Field totalTaxAmount Decimal Yes
    Field totalAmountIncludingTax Decimal Yes
    Field fullyShipped Boolean
    Field status Enum "Sales Order Entity Buffer Status" Yes
    Field lastModifiedDateTime DateTime Yes
    Field phoneNumber Text[30]
    Field email Text[80]
    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.0

    Back to top Copyright © 2020 SmartApps
    Generated by DocFX