web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Purchase Invoice Lines Resource MS 365 API Documentation

(0) ShareShare
ReportReport
Posted on by

pastedimage1592365242493v1.png

Hi, towards the bottom of the above photo, there is this property called "accountId" whose description is given as "The Id of the Account that will be used for this line. lineType will automatically be set to "Account" if this is set". 

I just wanted to clarify what the 'accountId' property exactly means. Does accountId mean the account number of the General Ledge Account to be debited/credited for the purchase? If so, does this account refer to the general ledger account of the supplier or of my company's accounts payable?

I hope somebody can clarify my confusion. Thank you

  • Suggested answer
    Ethan-Sorenson Profile Picture
    225 on at

    The AccountId is a GUID which likely means it is looking for the SystemId for that particular record. When I import Purchase Invoices I use the purchase invoice page(51), and include the linked entity of PurchaseInvoicePurchaseLines as you can see when checking the metadata.

    I will set the line type = 'Account' and No = 'My Account Number' and the system will automatically populate the description and account Id fields.

  • Community Member Profile Picture
    on at

    In which resource is this "No" field that you are talking about found? Also, No = 'My Account Number' refers to the general ledger account number of my firm from which the funds are flowing out from to go to my supplier right? Thank you

  • Ethan-Sorenson Profile Picture
    225 on at

    The No field is the general ledger account that will be used for the funds correct.

    fyi, If you were to change the line type to 'Item" then the No field would be an Item number.

    In Business Central go to the Web Services Page and publish the page you need. Then you will be able to access it through the api.

    To view the data returned to help understand what you need to provide try using a get on this endpoint. https://api.businesscentral.dynamics.com/v2.0/{GUID}/Production/ODataV4/Company('CRONUS%20US')/PurchaseInvoice?$expand=PurchaseInvoicePurchLines

    (Replace GUID with your Instance and the Company will need to change if it isn't Cronus that you are using)

    Purchase_5F00_Invoice_5F00_Page.png

  • Ethan-Sorenson Profile Picture
    225 on at

    Here is a sample Payload and a screenshot of doing it from Postman

    {
       "Document_Type": "Invoice",
       "Buy_from_Vendor_No": "10000",
       "Buy_from_Vendor_Name": "Fabrikam, Inc.",
       "PurchaseInvoicePurchLines": [
           {
               "Document_Type": "Invoice",
               "Type": "G/L Account",
               "No": "60300",
               "Quantity": 1,
               "Direct_Unit_Cost": 500
           }
       ]
    }
    PurchaseInvoicePostman.png
  • Verified answer
    Community Member Profile Picture
    on at

    Thank you for clarifying Ethan. I will update any questions here if required :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 796 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 481 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 377 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans