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 / Need Help with Setting...
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!

 

Categories:
I have the same question (0)
  • jrletner Profile Picture
    720 Moderator on at

    @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)

  • jessicadduffey Profile Picture
    on at

    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?
  • jessicadduffey Profile Picture
    on at

    @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?

  • Verified answer
    jessicadduffey Profile Picture
    on at

    @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!

  • jrletner Profile Picture
    720 Moderator on at

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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard