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

Notifications

Announcements

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
    97,089 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

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,167

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,184

#3
YUN ZHU Profile Picture

YUN ZHU 1,161 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans