Show / Hide Table of Contents

    API - Sales Invoices

    This is a fork of page 30012 "APIV2 - Sales Invoices" from version 23.3.14876.15704. Added support for Extra Values.

    Object Definition

    Object TypePage
    Object ID70314155
    Object NameQWESR API - Sales Invoices
    Source TableSales Invoice Entity Aggregate

    API Definition

    APIPublishersmartApps
    APIGroupspider
    APIVersionv1.0
    EntitySetNamesalesInvoices
    EntityNamesalesInvoice

    Service Enabled Procedures

    Name Description
    Cancel(WebServiceActionContext) Cancels an already posted Sales Invoice.
    CancelAndSend(WebServiceActionContext) Cancels and sends the current Sales Invoice.
    MakeCorrectiveCreditMemo(WebServiceActionContext) Creates a Credit Memo that corrects the current Sales Invoice.
    Post(WebServiceActionContext) Posts the current Sales Invoice.
    PostAndSend(WebServiceActionContext) Posts and Sends the current Sales Invoice to customer.
    Release(WebServiceActionContext) Releases the current Sales Invoice.
    Reopen(WebServiceActionContext) Reopens the current Sales Invoice.
    Send(WebServiceActionContext) Sends the current Sales Invoice to the customer.

    Events

    Name Description
    OnAfterInsert(Record "Sales Invoice Entity Aggregate"; 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 Invoice Entity Aggregate"; Record "Sales Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text; List of [Integer]) Raised after a record is modified.
    OnGetPostedSalesInvoiceExtraValues(Record "Sales Invoice Entity Aggregate"; Record "Sales Invoice Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text) Raised after a record is read from the database. This event is raised if the Sales Invoice is posted. Makes it possible to set the ExtraValues 1..10, to be returned to the client.
    OnGetSalesInvoiceExtraValues(Record "Sales Invoice Entity Aggregate"; Record "Sales Header"; Text; Text; Text; Text; Text; Text; Text; Text; Text; Text) Raised after a record is read from the database. This event is raised if the Sales Invoice is not posted. Makes it possible to set the ExtraValues 1..10, to be returned to the client.

    Example

    Read

    Get a list of Sales Invoices.

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

    Get a single Sales Invoice and it's lines.

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

    Create

    Create a new Sales Invoice and a Sales Invoice Line.

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

    Update

    Set the field discountAmount on a Sales Invoice.

    In Business Central the Invoice Discount is distributed to all Sales Invoice Lines. To be able to set discountAmount, all Sales Invoice Lines must be added first (with a POST, see above), then do a PATCH to set discountAmount.

    PATCH businesscentralPrefix/companies({id})/salesInvoices({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 invoiceDate Date
    Field postingDate Date
    Field dueDate Date
    Field customerPurchaseOrderReference Text[35]
    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 currencyId Guid
    Field shortcutDimension1Code Code[20]
    Field shortcutDimension2Code Code[20]
    Field currencyCode Text
    Field orderId Guid Yes
    Field orderNumber Code[20] Yes
    Field paymentTermsId Guid
    Field shipmentMethodId Guid
    Field salesperson Code[20]
    Field pricesIncludeTax Boolean Yes
    Field remainingAmount Decimal Yes
    Sub page dimensionSetLines
    Sub page salesInvoiceLines
    Sub page pdfDocument Yes
    Field discountAmount Decimal
    Field discountAppliedBeforeTax Boolean Yes
    Field totalAmountExcludingTax Decimal Yes
    Field totalTaxAmount Decimal Yes
    Field totalAmountIncludingTax Decimal Yes
    Field status Enum "Invoice Entity Aggregate 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