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

Drill Down to open Page

(0) ShareShare
ReportReport
Posted on by

I'm sure this is a very basic request but I am struggling with lack of a central repository for syntax for AL.

I want to be able to click on an existing field (i.e. Contact Name in the Customer List) and have it open the Contact Card for that contact.

I have created the trigger for OnDrillDown but what I don't understand is how to get the "Contact" record to pass it through.  This is what I have so far from trial and error in my page extension for Customer List.

modify(Contact)
        {
            trigger OnDrillDown()
            var
                ctrec: Record Contact;
            begin
                
                ctrec.SetRange("Lookup Contact No.", "No.");
                Page.Run(page::"Contact Card", ctrec);
                
            end;
        }
I have the same question (0)
  • tanya07 Profile Picture
    1,638 on at
    RE: Drill Down to open Page

    Hey,Sherry Jackson

    Like wise as Dan Kinsella just used GET and suggested to use filters, this simple code below might help :)

    trigger OnDrillDown()

              var

                  ContactP: Page "Contact Card";

                  ContactR: Record Contact;

              begin

                  ContactR.SETRANGE(ContactR.Name,Contact);

                  ContactR.FINDFIRST;

                  ContactP.SETRECORD(ContactR);

                  ContactP.RUN;

              end;

    It worked for me.

    ---------------

    Tanya Kharbanda

    Microsoft Dynamics 365 Business Central Technical Consultant

  • Dan Kinsella Profile Picture
    468 on at
    RE: Drill Down to open Page

    Yes the "No." field is the primary key for the Contact table, so I used that above in the Customer.Get() line.

    You'll need to find the contact record you want, easy if you have the primary key. Otherwise you'll need to filter on some other fields such as the name, address.. whatever you have available from the page you're looking up from.

  • Community Member Profile Picture
    on at
    RE: Drill Down to open Page

    Thanks Dan.  When on the Customer List I only see a field called Contact on the Customer table.  I'm not sure what this pertains to.  I assume it would be the No. field for the Contact but I'm not sure.  How do I know what value is stored here and how do I get the current record's ContactNo to pass this?

  • Suggested answer
    Dan Kinsella Profile Picture
    468 on at
    RE: Drill Down to open Page

    Hi Sherry,

    If you use a variable of type page, you can set the record you want to open. e.g.

               trigger OnDrillDown()

               var

                   ContactPage: Page "Contact List";

                   Contact: Record Contact;

               begin

                   Contact.Get(ContactNo);

                   ContactPage.SetRecord(Contact);

                   ContactPage.Run();

               end;

  • Community Member Profile Picture
    on at
    RE: Drill Down to open Page

    Thanks I'll start there.

  • Suggested answer
    Renni Profile Picture
    958 on at
    RE: Drill Down to open Page

    Go to Microsoft learn and filter on business central and role of developer

    Lots of useful information and guides that will help you with this issue

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,406

#2
Sumit Singh Profile Picture

Sumit Singh 2,852

#3
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,217

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans