Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Get Record of Current Page from within SubPage

Posted on by 15

Hi all!

I have two tables, a "Project" table and a "Projectline" table. I have a card page for the Project, and within that card page I have a Page (Type=ListPart) for my ProjectLines. I would like to include the primary key of the Project table in my ProjectLine table, however I don't know how to copy that value because I am not technically within the Project table while I'm inserting new records into the ProjectLines Subpage.

Can anyone help me get the value of the Project Table, and insert it into the projectlines record table?

Side note: If anyone has tutorials on finding/sorting/filtering records, I would love to see them.. I cannot quite make sense of Microsoft's built-in documentation..

Thanks!

Categories:
  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Get Record of Current Page from within SubPage

    Hi Garrett B,

    To include the primary key of your Project table in the ProjectLine subpage you need to add the table relation and then subpage link it to your cardpage.

    In your Project Line table

            field(1; ProjectNo; code[20])
            {
                TableRelation = ProjectTable.ProjectNo;
            }
            field(2; LineNo; Integer)
            {
                AutoIncrement = true;
            }
        }
    
        keys
        {
            key(PK; ProjectNo, LineNo)
            {
                Clustered = true;
            }
        }

    In your project card page

                    part(ProjectLineSubPage; ProjectLineSubPage)
                    {
                        ApplicationArea = All;
                        SubPageLink = ProjectNo = field(ProjectNo);
                        Caption = 'Project Lines';
                    }

    Make sure that ProjectNo is the primary key value in your Project Table as well.
    Let me know if you have any further questions

    Regards

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans