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 :
Small and medium business | Business Central, N...
Suggested Answer

Passing variables between subpages

(1) ShareShare
ReportReport
Posted on by 25
Hi all,
 
I have a card page which is linked to some header table, and in the card page, two subpages (both listparts) - one is a lines page (lines of header) and the other is some item page (individual items of the line). So all three tables/parts work together in some way. What I am trying to do seems very simple but for some reason it is causing me so many headaches.. Simply put, when entering a new record in the item subpage, it should automatically enter in the line no. in a field in item page of the current selected line. This same functionality works when entering a new line record. It automatically pulls the header No. into a field in the new line rec. So with the items, this doesn't happen and instead I get this message when clicking on a new line:
This message makes sense as the item records shown should only be linked to the specific line selected but I'm not sure how to solve this. The easy solution is to have this filter message present until a user manually enters in the correct line no., but the issue is that I want to hide that field and automatically do it. Another solution I thought would be to pass a variable between subpages and that is my main focus now (unless someone could explain how to make it so it automatically fills in via normal nav functionality). So I'm now at the point where when any line is selected I want to call a function in the item page to set the line no... This also causes me many issues as I'd like to simply call the function from the page, but it calls the function of another item list instance (since I just made a variable of type page - subtype: item page). So another thought would be to get the correct instance but that also gives me issues as you cannot re-set a page variable in code (/assignment of this variable is not allowed/). 

So.. I have it so there is a function in the card page which passes the item page instance to the line subpage which passes the selected line rec by calling the function of the passed argument. The issue with this is I need to call the card page function from the line subpage after selecting a record, but how can I get the correct card page instance to accomplish this? It would be nice to just call a function to set the instance to some variable but it doesn't seem possible, and even calling a getter function to get the instance doesn't seem possible....
 
Sorry this was so much, please help..
Thanks
I have the same question (0)
  • Jaden Kuhn Profile Picture
    25 on at
    Hopefully all of that made sense^
  • Jaden Kuhn Profile Picture
    25 on at
    Well this technically is not an answer to my passing variables problem, but I found out the solution to my actual issue. I did not realize that the primary key(s) of the subforms need to contain the same primary keys of the parent. So originally I just had the primary key of my item table (not the actual nav item table) just as an entry no. But now I also included the line no. and header no. too. 
     
  • Suggested answer
    YUN ZHU Profile Picture
    95,750 Super User 2025 Season 2 on at
    Hi, you can refer to the Sales Header and Sales Line on the Sales Order page.
    If you need to transfer variables to other pages, you need to create functions on other pages.
    Here is a simple example, I hope it can give you some hints.
     
    Thanks.
    ZHU

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans