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...
Suggested Answer

API Issue when other page part exists in page

(0) ShareShare
ReportReport
Posted on by 107
page 80140 "API Sales Order"
{
    PageType = API;

    APIVersion = 'v1.0';
    APIPublisher = 'bcAPI';
    APIGroup = 'Sales';

    EntityCaption = 'SalesOrder';
    EntitySetCaption = 'SalesOrder';
    EntityName = 'salesOrder';
    EntitySetName = 'salesOrder';

    ODataKeyFields = SystemId;
    SourceTable = "Sales Header";

    Extensible = false;
    DelayedInsert = true;

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field(orderId; Rec.SystemId)
                {
                    Caption = 'Id';
                    Editable = false;
                }
                field(documentType; Rec."Document Type")
                {
                    Caption = 'Document Type', Locked = true;
                }
                field(docNo; Rec."No.")
                {
                    Caption = 'Document No', Locked = true;
                }
                field(customerNo; Rec."Sell-to Customer No.")
                {
                    Caption = 'Customer No', Locked = true;
                }
                field(contactName; Rec."Sell-to Contact")
                {
                    Caption = 'Contact Name', Locked = true;
                }
                field(orderDate; Rec."Order Date")
                {
                    Caption = 'Order Date', Locked = true;
                }
                field(documentDate; Rec."Document Date")
                {
                    Caption = 'Document Date', Locked = true;
                }
                field(postingDate; Rec."Posting Date")
                {
                    Caption = 'Posting Date', Locked = true;
                }
                field(externalDocNo; Rec."External Document No.")
                {
                    Caption = 'External Document No.', Locked = true;
                }
                field(yourReference; Rec."Your Reference")
                {
                    Caption = 'Internal Reference No', Locked = true;
                }
                part(salesOrderLines; "API Sales Order Lines")
                {
                    Caption = 'Order Lines';
                    EntityName = 'salesOrderLine';
                    EntitySetName = 'salesOrderLines';
                    SubPageLink = SystemId = field(Id);
                    // SubPageLink =  "Document Type" = field("Document Type"), "Document No." = field("No.");
                }
            }
        }
    }
page 80141 "API Sales Order Lines"
{
    PageType = API;

    APIVersion = 'v1.0';
    APIPublisher = 'bcAPI';
    APIGroup = 'Sales';

    EntityCaption = 'SalesOrderLine';
    EntitySetCaption = 'SalesOrderLines';
    EntityName = 'salesOrderLine';
    EntitySetName = 'salesOrderLines';

    ODataKeyFields = SystemId;
    SourceTable = "Sales Line";

    Extensible = false;
    DelayedInsert = true;

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field(salesLineid; Rec.SystemId)
                {
                    Caption = 'Id';
                    Editable = false;
                }
                field(documentType; Rec."Document Type")
                {
                    Caption = 'Document Type', Locked = true;
                }
                field(docNo; Rec."Document No.")
                {
                    Caption = 'Document No', Locked = true;
                }
                field(docLineNo; Rec."Line No.")
                {
                    Caption = 'Document Line No.', Locked = true;
                }
                field(lineType; Rec.Type)
                {
                    Caption = 'Line Type', Locked = true;
                    trigger OnValidate()
                    begin
                        if Rec.Type <> Rec.Type::Item then
                            Error('Line Type must be Item');
                    end;
                }
                field(lineTypeNo; Rec."No.")
                {
                    Caption = 'Line Type No.', Locked = true;
                }
                field(lineDescription; Rec.Description)
                {
                    Caption = 'Line Description', Locked = true;
                }
                field(unitMeasure; Rec."Unit of Measure Code")
                {
                    Caption = 'Unit of Measure Code', Locked = true;
                }
                field(quantity; Rec.Quantity)
                {
                    Caption = 'Quantity', Locked = true;
                }
                field(unitPrice; Rec."Unit Price")
                {
                    Caption = 'Unit Price', Locked = true;
                }
            }
        }
    }
}
When
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    98,128 Super User 2026 Season 1 on at

    Hi, Here is a good example that I hope will give you some hints.

    https://www.kauffmann.nl/2020/07/01/deep-insert-with-business-central-apis-part-2/

    Thanks.

    ZHU

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,033 Super User 2026 Season 1

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,105 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 1,035 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans