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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set global variable fr...
Power Apps
Unanswered

Set global variable from combo box selection

(0) ShareShare
ReportReport
Posted on by 184

Hi. 

I am trying to create a dropdown that contains a list of items. The user is supposed to select which item belongs to them, and once they do, they will navigate to the next screen with that item selected.

 

To achieve this, I am setting a global variable called varAffiliation in the OnChange of the ComboBox1:

 

Set(
 varAffiliation,
 ComboBox1.Selected.Name
);
Navigate(
 'SIB MD Main Screen',
 ScreenTransition.Cover
);

 

 

When it navigates over to the next screen, the global variable varAffiliation is listed as blank. Can someone let me know what I am doing wrong here? 

Categories:
I have the same question (0)
  • BoHamad Profile Picture
    on at

    Hi @Schwartz_Cory 

     

    it seems you’re doing it right but maybe there is a method affect the value of the global variable some where. You can check the usage of the variable, and check the cycle of your process if there is a method make changes on your variable 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Schwartz_Cory 

    Try 

    Set(
     varAffiliation,
     ComboBox1.SelectedItems
    )
  • Schwartz_Cory Profile Picture
    184 on at

    Thanks for the idea. 

    I am using this variable and changing it multiple times throughout the app. I tested your idea by changing varAffiliations to varTest and still have the same results. (varTest is blank on the next screen)

  • Schwartz_Cory Profile Picture
    184 on at

    This turns the variable into a table. I just need the name of the selected item from the combo box.

  • BoHamad Profile Picture
    on at

    Hi @Schwartz_Cory 

     

    try to pass the variable with a param

     

    Navigate(yourscreen,your transaction, { varTest : ComboBox1.Selected.Name})

  • Schwartz_Cory Profile Picture
    184 on at

    Good idea too, however still did not fix the issue and varTest is still blank on the 'SIB MD Main Screen'. 

     

    Navigate(
     'SIB MD Main Screen',
     ScreenTransition.Cover,
     {varTest:ComboBox1.Selected.Name}
    );

     

     

    I would rather this variable be a global variable instead of a context/local variable

  • Schwartz_Cory Profile Picture
    184 on at

    Update: Currently still facing this issue. Only workaround was to set the selected item in the combo box onto a button and have the user click on the button to set the variable while navigating to the next screen. That method works but I would rather it be OnChange of the combo box. oh well. 

     

    Note: using dataverse in the combo box selection, not sure if it plays a factor or not in debugging.

  • BoHamad Profile Picture
    on at

    Hi @Schwartz_Cory 

     

    in this case set the visibility of the button to false then onchange of the combobox

    Try:

    Select(nameofthebutton)

     

    hope this help

  • Schwartz_Cory Profile Picture
    184 on at

    Honestly I thought this would work, but still same! The variable does not carry over into the next screen. 😞
    But it works fine if the user manually clicks the button. Weird!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,055

#2
Valantis Profile Picture

Valantis 666

#2
11manish Profile Picture

11manish 666

Last 30 days Overall leaderboard