Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Need Help with Setting Variables

(0) ShareShare
ReportReport
Posted on by

Hi friends!  I need some assistance with setting variables within my power app.  I will try to explain this as briefly as possible...

I am building a multi-screen form app that stakeholders will use to alert my team that an interview needs to be scheduled.  Datasource is a Sharepoint site and the app will allow for both submitting new requests and updating existing requests.  Here is the first screen of the app:

jessicadduffey_0-1717782249305.png

I'm having no issue with adding new items.  The problem I'm running into is when current items need to be updated, and I think it is because of the variables I have set on some of these screens.

Screen section 1 is below with a tree view.  The user will only navigate to ScreenSection1 when they are adding a new request:

jessicadduffey_0-1717783365010.png

The user navigates to ScreenSection2 once the Next Screen button is clicked on ScreenSection1, or an item is selected from the gallery on Screen1to edit:

jessicadduffey_1-1717783960906.png

The values are showing up blank when editing a request, presumably because I have no variables set because the user skips over Screen1 when editing an item.  So, my question is this - how do I get the form data to show up on this screen for an item that has already been entered and needs to be edited (i.e. it is selected from the gallery on Screen1)?  

TIA!

 

  • jrletner Profile Picture
    715 Super User 2025 Season 1 on at
    Re: Need Help with Setting Variables

    @jessicadduffey nothing wrong with some good old fashioned Rubber Duck Debugging!! Congrats on getting it figured out!

  • Verified answer
    jessicadduffey Profile Picture
    on at
    Re: Need Help with Setting Variables

    @jrletner ...so I figured this out.  This seems to be happening to me a lot lately - I have an issue, I bring it to the power platform community, and once I've talked it through I figure it out. 🙂  I'm using an If(IsBlank) function to check for the variable set when creating a new record, and when it comes back as blank, I am inserting gblCurrentRecord as the alternative. 🙂  Thanks!

  • jessicadduffey Profile Picture
    on at
    Re: Need Help with Setting Variables

    @jrletner I think I know what's going on but I'm not sure how to fix it...

    When a request for a new record is submitted on ScreenSection1, the information is coming from a different data source (AllOpenRoles).  So, all of the highlighted items on ScreenSection are coming from AllOpenRoles, NOT Diversity Reporting List for Power Apps.

    jessicadduffey_0-1718037434541.png

    How can I tell the app that when someone is editing a request, the item properties need to be from the Global Variable tied to Diversity Reporting List for Power Apps, and if someone is creating a new request, the item properties need to come from AllOpenRoles?

  • jessicadduffey Profile Picture
    on at
    Re: Need Help with Setting Variables

    Hi @jrletner  - thank you for your response!  Sorry that you had issues reading the text on my screenshots.  I did set a global variable in the OnSelect property of the gallery (of items submitted already) on Screen 1: 

    OnSelect: 

    Set(gblCurrentRecord,ThisItem);EditForm(frmMaster);Reset(TextInput1);Navigate(ScreenSection2)
     
    But, having said that, this is also the variable I set in the OnSelect function for starting a new record:
    Set(gblCurrentRecordDefaults('Diversity Panel Reporting List for Power Apps'))
     
    I thought that because the button for starting a new record is not being selected during an edit request, it wouldn't make a difference that I was using the same variable.  Does that make a difference?
  • jrletner Profile Picture
    715 Super User 2025 Season 1 on at
    Re: Need Help with Setting Variables

    @jessicadduffey I had issues reading all of the code on the screenshots, so I apologize if I'm misunderstanding your issue completely. I have a suspicion that you're not getting what you want because you're using context variables. A context variable is only available on the page it's declared on (unless you actually pass it through the Navigation function). To test this theory, you could do 1 of 2 things:

    1. Pass the context variable through the Navigate function:

    jrletner_0-1717802042644.png


    2. Change the context variables to global variables using Set:

          Set(varName, value)

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,658 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