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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple global variab...
Power Apps
Suggested Answer

Multiple global variables to set form field

(1) ShareShare
ReportReport
Posted on by 6
I'm hoping someone can help me. 
 
I have a Power app that allows users to submit a form based on specific content types. 
There are two screens. 
 
Screen 1: Have buttons that the user may select to launch a New Form(1) which is on Screen 2. 
Here's the button syntax that is modified based on the content type. 
ResetForm(Form1);
ResetForm(Form1);
NewForm(Form1);
Set(varItem,Defaults('Change Request'));
Set(varRecordType,"New");
Set(varItem,Blank());
Set(varBasic,true);
Set(varOrg,false);
Set(varStrategic,false);
Set(varOps,false);
Set(varCA,true);
Set(varVendor,false);
Patch(varItem,{ChangeType:"Corrective Action"});
Navigate(SubmissionScreen,ScreenTransition.Fade,{ChangeType:"Corrective Action"})
Screen 2: Is Form(1). Fields are visible based on the variables set with Screen 1. 
I have a choice field called ContentType. 
I would like to have this field change based on the true variable set by the button on Screen 1. 
 
I don't know what else to try. 
Please help
Categories:
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,847 Super User 2025 Season 2 on at
    You can use the "DefaultSelectedItems" in the choice field (I'm assmuing that is dropdown) and define the varItem inside "DefaultSelectedItems"
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,392 Super User 2025 Season 2 on at
    Hi,
     
    I am a little confused. You said that the above values change based on the Content Type but I dont see any such code. I just see you setting values.
     
    Also, why are you creating so many Global Variables, its a very bad pattern to get into.
     
    You are already passing the Change Type, but to be cleaner, you should create a single Collection, that has all of these and pass that as part of your Navigate.
     
    Anyway thats secondary, but what True (variable) are you using to set the Correction Type.
     
    Again I don't think you have explained it enough to clarify for my (brain lol)... can you give a specific Example like
     
    I do this on Screen 1 and it sets the variable to True
    then on screen 2 I do XYZ and it shows ABC
     
    Because right now you are already passing the Change Type, so I am wondering if your issue is that you WANT to pass the ChangeType from Screen One, but NOT as a hard coded value??? and you want to know how to decide which one to pass from screen 1 to screen 2 based on something you are doing in screen 1?
     
     
  • SD-04091709-0 Profile Picture
    6 on at
    Thank you FLMike. 
     
    I'll try to provide more details. 
     
    I created a global variable for each content type because the content types have different form fields associated to them. I'm probably going about this all wrong. 
    The goal is to have the button on Screen 1 change the Content Type combo box on Screen 2 to reflect the content type associated with the selected button on Screen 1. 
     
    Screen 1: has five buttons. Organizational; Strategic; Operational; Corrective Action; and Vendor. 
    If the user selections the Organizational button, I want to navigate to the Form Screen 2: and change the Content Type combo box to change to "CMOrganizational".
     
    I only have one form, therefore one field for content type. I need the content type to change based upon the button selected on screen 1. 
     
    I tried to create a new field called Change Type but that didn't work either. 
     
    Does that help explain my mess? 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard