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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)
Answered

Get Code of Parent Page

(0) ShareShare
ReportReport
Posted on by

Dear Community,


I am having difficulties regarding Sub Pages and Parent Pages.
I have an parent page called x, with a subpage called y.

In Y, you can create new records with a field saying "x" to show that this record belongs to this particular parent.

When creating a new y record, I would like to have the field "parent" filled automatically with the code of the parent page. But honestly, I have no clue how to manage this.

I hope, I described my problem in a understandable way.

Cheers for your help!

The NAV newbie Ben

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    You can call a function in another page using a Page Variable.

    You can declare a variable in CAL Globals with DataType as Page and use it to access the function.

    But before you do so just check how your requirement is addressed in standard.

  • Suresh Kulla Profile Picture
    50,241 Super User 2025 Season 2 on at

    Honestly i did not understand your query, please try to explain using the actual page names and what are you trying to do. You can always call the other functions ofother pages or records creating respective variables and calling that function.

  • Amol Salvi Profile Picture
    18,698 on at

    Hi

    How your tables are designed for the functionality you are creating ?

    For reference you can check Sales order where Sales Header and Sales line are connected and Sales header primary key fields inserted automatically in Sales Line when user enter new line

  • Community Member Profile Picture
    on at

    Hey people,

    thanks a lot for your quick replies. It is actually like -as Amol pointed out- the sales header and sales Line on the sales order page.

    I have created a table with the corresponding page called Garage. The page contains a subpage called Car list, that also has a table with the name Car. One column of that table is called "Garage code" and is the code of the Parent page Garage .

    Now with every new record on this subpage Car list, I want that column to be filled automatically.

    So basically, it is, as already mentioned, the same procedure as in the Sales order Page. After a few hours of trying today, I was not able to achieve this.

    I saw that the Subpage Sales Line has a function called "setSalesHeader" that is called from the Parent Page Sales Header. And tried this template without any success.

    Also, I actually want this to happen on the Garage page itself, not on the table level - or is this impossible?

    Thanks again!

    Ben

  • Suresh Kulla Profile Picture
    50,241 Super User 2025 Season 2 on at

    How do you link these two pages ? What are the keys. If you look @ Sales Order Page the link is Document NO. and you don't need to add the code to populate them, since that is the link it will auto populate those values, i am think the Garage Code is the key to link those so you need to set that in the link.

  • HoangNam Profile Picture
    315 on at

    From NAV 2015, You can reference UpdatePropagation Property of a part.

    If you set UpdatePropagation=Both, When you call a CurrPage.Update from Subpage Y then CurrPage.Update of Page X is also run. So you can call a function at AfterGetRecord, AfterGetCurrRecord,...

    UpdatePropagation.jpg

  • Community Member Profile Picture
    on at

    People, thanks for your replies.

    The Car list is a Part of the Garage Page, linked via "Part" within the Garage Page. I already set the SubpageLink "Garage Code=FIELD(Code)" and it already just shows the cars listed in this garage. But when adding a new car line, it does not set the new location code automatically.

  • Community Member Profile Picture
    on at

    Just for clarification whats making me wondering:

    When I use Actions in the Ribbon, using the C/AL Code  "Garage Code" := GETFILTER("Garage Code"); sets the correct value.

    Using the same code on the Page using "SubPageLink" on the Part Page properties doesn't work.

    So using GETFILTER works on RunPageLink Property but not on SubPageLink Property?

  • Verified answer
    Community Member Profile Picture
    on at

    I solved it myself. I made an function in the Car List part, setting the garage code in global variable, that is passed into every new Record within the onNewRecord function.

    The setGarageCode is called in the Garage Page Code onAfterGetRecord.

  • Community Member Profile Picture
    on at

    Hello,

    I've got the same problem as @whabada.

    I already set the SubpageLink, all data is listed in the subpage list but I want to pass Id from parent page to child (sub) page during creation of new record in the list in the subpage.

    @whabada - how did you pass your id/No. from your Garage Page to Car list (subpage) using function?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans