web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,011

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
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    127 on at
    RE: How to enable click and navigate on a Page control

    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,011 on at
    RE: How to enable click and navigate on a Page control

    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

Responsible AI policies

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

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,267

#2
Sumit Singh Profile Picture

Sumit Singh 2,098

#3
YUN ZHU Profile Picture

YUN ZHU 1,766 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans