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

How to enable click and navigate on a Page control

(0) ShareShare
ReportReport
Posted on by 3,029

I have created a table, with a complex table relation in a field:

field(1; InvoiceNo; Code[20])
        {
            Caption = 'InvoiceNo';
            DataClassification = ToBeClassified;
            TableRelation =
        if ("Document Type" = const(Invoice)) "Sales Invoice Header"."No."
            else
            if ("Document Type" = const("Credit Memo")) "Sales Cr.Memo Header"."No.";
        }
Then I created a read only List Page, with all elements of this table. The relation is working correctly, but when I click or double click the InvoiceNo field, It doesn't open the Posted Sales Invoice Card or the Posted Cr. memo Card.
I can only open the page using the link in the lookup
any ideas on how to enable opening on a click or double click?
pastedimage1632741555250v1.png
  • Suggested answer
    JAngle Profile Picture
    159 on at

    Different scenario but similar requirement. I have a field on the G/L entries to show me the source record name of the posting - so for customer it's the customer name etc. I have a drilldown set on the calculated field and it opens the card page directly based on whichever record it is. Here is some sample code. Might help you.

    My field to show the name of the record relating to the G/L entry:

    addafter("Source Code")
            {
                field("Source Name"; SourceName)
                {
                    ApplicationArea = All;
                    Caption = 'Source Name';
                    trigger OnDrillDown()
                    var
                    DataDrillDown: Codeunit "Data Tasks";
                    begin
                        DataDrillDown.SourceNameDrillDown(Rec."Source Type",Rec."Source No.");
                    end;
                }
            }

    Doesn't include all the code but it effectively just loops through depending on what the drilldown record relates to and calls a page opening function

    procedure SourceNameDrillDown(var RefType: Enum "Gen. Journal Source Type"; var RefCode: Code[20])
        var
            DataRefType: Enum "Gen. Journal Source Type";
            Cust: Record Customer;
            Vend: Record Vendor;
            Bank: Record "Bank Account";
            Empl: Record Employee;
            FA: Record "Fixed Asset";
        begin
            DataRefType := RefType;
    
            case DataRefType of
                DataRefType::" ":
                    Page.RunModal(0);
                DataRefType::"Bank Account":
                    begin
                        Bank.Init();
                        if Bank.Get(RefCode) then
                            GetBankAccountPage(Bank);
                    end;
                DataRefType::Customer:
                    begin
                        Cust.Init();
                        if Cust.get(RefCode) then
                            GetCustomerPage(Cust);
                    end;
                end;
            end;

    page opening function example. So you could create two of these - one for the sales invoice and one for the sales credit memo:

    local procedure GetCustomerPage(var Customer: Record "Customer")
        var
            CustLookup: Page "Customer Card";
        begin
            CustLookup.Editable := false;
            CustLookup.SetTableView(Customer);
            CustLookup.RunModal();
        end;

  • Ghetz Profile Picture
    3,029 on at

    Actually I was expecting a standard way of doing it without code, just like when you click the order No. on the Sales Order list, the order card opens up. I guess this only works when there is a ListPage - CardPage relation.

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 676 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 483 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 310 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans