Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Fzf3iZKcb/cTG/uWwHzp8w
Power Apps - Building Power Apps
Suggested answer

Global variable is not passing to other pages

Like (0) ShareShare
ReportReport
Posted on 23 Apr 2025 15:34:20 by
 Hi,
 
I have been working on creating my own app and I'm trying to pass a variable from one page to another (not from one screen to another) and for some reason it's not populating even though it says "Global Variables are defined across the app and can be referenced by other screens. Maybe I'm miss interpreting it but regardless I need to pass a variable from one page to another. I have set the variable:
 
Set(selected, Associated.Selected.'Name'); # This is selected from a table within the page
selected; # This is checking that the variable is holding the information on row select, it does hold the value check video
Navigate('Directory', ScreenTransition.None, selected# I get issues with this because it says the 'Directory' (The other page) is not a control or a screen for this page of the app
 
I also attempted it with a button and it still refused to pass the variable to the other page:
Set(selected, Associated.Selected.'Name');
selected;
Navigate(ToBOM, ScreenTransition.None, {selected : Associated.Selected.'Name'}) # ToBOM is the button (or "Control") that I was attempting to use
 
I'm really at a loss here because it should be defined across the app not just across one page of the app. SOS
 
  • WarrenBelz Profile Picture
    146,660 Most Valuable Professional on 24 Apr 2025 at 02:23:32
    Global variable is not passing to other pages
    There are a number of things you are duplicating here that may be the cause of your issue. Firstly, let's keep it simple - assuming Associated is the name of the Gallery (galAssociated would be a better naming protocol), you also need to stay away from selected as it is a Reserved Word in Power Apps.
    Set(
       varSelected, 
       Associated.Selected.'Name'
    ); 
    Navigate(
       'Directory', 
       ScreenTransition.None
    )
    If the 'Name' (not a good field title) field in the record selected in the Associated Gallery contained the relevant value, then this certainly will be available as varSelected on the second screen.
     
    Looking at your present code, when you did this
    Navigate(
       ToBOM, 
       ScreenTransition.None, 
       {selected : Associated.Selected.'Name'}
    )
    you actually attempted to set a second Variable (a Context Variable applicable only to the second sereen) with the same name and taking precedent over the Global Variable you might have set earlier.
    I am not sure what effect this had,
    Navigate('Directory', ScreenTransition.None, selected)
    but is not valid syntx that will assist anything.
    So please try the process at the top of the post - it should work for you.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Suggested answer
    MS.Ragavendar Profile Picture
    1,597 on 23 Apr 2025 at 16:30:55
    Global variable is not passing to other pages
     
    I would like to understand, Global Variable means global across the screens in the app no need to pass from the one screen to another screen.
     
     
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    âś… Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started
Loading complete