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

Business Central API - Create Custom API Page for Sales Invoice Lines

(0) ShareShare
ReportReport
Posted on by 5

I need to create a custom API Page for Business Central on Dynamics 365. I need to get a the AL source for the API Method

api.businesscentral.dynamics.com/.../salesInvoiceLines

Does anyone know where I can find the AL source for the SalesInvoiceLines method above?

I have copied the AL source from my Docker Windows Container to a directory C:\bcSandbox\applications\APIV1\Source_Exclude_APIV1_.Source

I can only find the AL source for a ListPart for the SalesInvoiceLines (see below), I may be wrong but not sure how I can POST new records to BC using a ListPart.

page 20043 "APIV1 - Sales Invoice Lines"
{
    DelayedInsert = true;
    PageType = ListPart;
    SourceTable = "Sales Invoice Line Aggregate";
    SourceTableTemporary = true;
    ODataKeyFields = Id;
    Extensible = false;

Would appreciate any help you can provide please as this change needs to go live urgently.

I have the same question (0)
  • Suggested answer
    Rehan Satti Profile Picture
    636 on at

    Hi MikeScally,

    I am not sure weather it would help or not, But you can try make custom api page of the by extending or replicating the stander-ad sales invoice line page 47 "Sales Invoice Subform" .

    Now the question how to get the source code of this page. hare are the steps.

    1)  Go to  AL projects workspace and look for the .alpackages folder as follows. 

    pastedimage1593675021234v5.png

    2) Open it in file explorer. copy the highlighted base app package in some other directory. change the file type to zip. extract the files from the zip file. You will find the all source code of the base app in the src folder.

    pastedimage1593675323668v6.png

  • MikeScally Profile Picture
    5 on at

    Hi Rehan,

    Thanks for your suggestion, the subform you have suggested is also a ListPart like the one I have below.

    I am looking to deploy a custom api page for integration with another application via the REST api

    is it possible to insert records to Business Central using a ListPart?

    page 20043 "APIV1 - Sales Invoice Lines"

    {

       DelayedInsert = true;

       PageType = ListPart;

       SourceTable = "Sales Invoice Line Aggregate";

       SourceTableTemporary = true;

       ODataKeyFields = Id;

       Extensible = false;

       layout

       {

           area(content)

           {

               repeater(Group)

               {

                   field(id; Id)

                   {

    .....

  • Suggested answer
    Rehan Satti Profile Picture
    636 on at

    Hi ,

    API page type is a new  page type in business central. from which you can add the data using REST api.

    docs.microsoft.com/.../devenv-api-pagetype

    this is how you can define it:

    page 50001 ChangeLogs

    {

       PageType = API;

       SourceTable = "Change Log";

       APIPublisher = 'Dynamics-inspire';

       APIGroup = 'LifaGroup';

       APIVersion = 'v1.0';

       EntityName = 'ChangeLogs';

       EntitySetName = 'ChangeLogs';

       DelayedInsert = true;

       Caption = 'ChangeLogs';

       Permissions = TableData 50504 = r;

       layout

       {

           area(content)

           {

               repeater(General)

               {

                   field(EnteryNo; "Entery  No")

                   {

                       Caption = 'EnteryNo';

                       ApplicationArea = All;

                   }

                   field(EntityID; "Entity ID")

                   {

                       Caption = 'EntityID';

                       ApplicationArea = All;

                   }

                   field(EntityType; "Entity Type")

                   {

                       Caption = 'EntityType';

                       ApplicationArea = All;

                   }

               }

           }

       }

    }

    Regarding your other question: I have used the standard job task page to insert the records using REST API

    pastedimage1593678996015v1.png

  • MikeScally Profile Picture
    5 on at

    Hi Rehan,

    Thanks for your help, yes I would like to make a Custom API Page as per your example above.

    I have already deployed a custom API Page for the Sales Invoice (header) and this is working nicely.

    The issue I have is I need the AL code for the standard API Page SalesInvoiceLines. The only AL source I can find is for a SalesInvloceLines ListPart which doesn't seem like what I need to POST invoice lines from the API.

    I can't seem to find the AL source for the API Page for SalesInvoiceLines, I really need this urgently.

    Do you know where I can get the source for the SalesInvoiceLines API method (see API Uri below?)

    api.businesscentral.dynamics.com/.../salesInvoiceLines

    Thanks for your support,

    Mike

  • Verified answer
    I Gusti Made Ari Profile Picture
    3,608 on at

    The objects you are looking for is  page 5475 "Sales Invoice Entity" and  page 5476 "Sales Invoice Line Entity"

    You can find it in base app source file

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,974 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,131 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 628 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans