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 / Power apps 'OnStart' g...
Power Apps
Answered

Power apps 'OnStart' global Variables are not being set

(1) ShareShare
ReportReport
Posted on by 12
I am setting multiple variables as a list on my 'OnStart' setting for my app. I am making them a list in order to show them as options for a drop down selector in a form. A couple days ago everything was working fine, but now all of the variables show as blank. I have attached pictures below. 






This is what it looks like after I click on the box to have the dropdown list show: 
Categories:
I have the same question (0)
  • MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    I tried to replicate the similar thing from my end.
     
     
    but i cannot experience any issue, which you are facing, just few queries.
     
    Q 1 : Did u tried running the app in the design mode by running App on start ? Does it return the same results? 
     
    Q 2:  Variable - RegionsAllowed did u reset the variable some where in the app ? can you please check.
     
    If nothing works for you i have simple suggestion. 
     
    Items property of the Dropdown add in this way.
     
    Table(
        {Value:""},
        {Value:"Australia Asia & Magnolia"},
        {Value:"Canada"},
       // your all collection value
    )
     
    🏷️ 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.
     
     
  • GP-29041548-0 Profile Picture
    12 on at
    @MS.Ragavendar ,

    for your questions below,
    1. I do not think I fully understand what you are asking. I probably have not tried this, so if you could explain the method a little more I could see if that fixes it.
    2. I have checked to make sure I am not resetting the variables anywhere.

    To give you a little more scope of the issue, this is my entire 'OnStart' code:
     
    Set(ProjectTypesAllowed, ["", "Technology","Production Improvement - Maintenance & Repair","Production Improvement - Application & Operation","MEM Services [SAT,MSR,GAT,etc]","HSEC [Health,Safety,Environment,Community]","Cost Reduction - Maintenance & Repair","Cost Reduction - Application & Operation","Aftermarket CI - Undercarriage","Aftermarket CI - GET","Aftermarket CI - Hydraulics","Aftermarket CI - Parts Ordering","Aftermarket CI - Powertrain","Aftermarket CI - Demand Planning","Aftermarket CI - Upgrades & Retrofits","Command","Command with Cat SPM"]);
     
    Set(MineAllowed, ["","Surface","Surface & Underground", "Underground"]);
     
    Set(RegionsAllowed, ["","Australia Asia & Magnolia","Canada","China & India","Europe & CIS","Northern Africa & Middle East","Northern Latin America","Southern Africa","Southern Latin America","USA"]);
     
    Set(AAMSubRegions, ["","Asia","Australia","Mongolia"]);
    Set(CanadaSubRegions, [""]);
    Set(CISubRegions, [""]);
    Set(EuropeCISSubRegions, [""]);
    Set(NAMESubRegions, [""]);
    Set(NLASubRegions, ["","Colombia", "Mexico", "Peru", "Suriname"]);
    Set(SouthernAfricaSubRegions, [""]);
    Set(SLASubRegions, ["","Brazil", "Chile"]);
    Set(USASubRegions, [""]);
     
    Set(FunctionsAllowed, ["", "Other", "Project Lead", "Resource", "Sponsor"]);
     
    Set(AdminToolAllowed, ["","Admin Message", "Project Types", "Mine Types", "Commodity Types", "Function Types", "Dealer Region", "Sub Region", "Dealer Location", "Customer", "Customer Site", "Account Manager", "Project Mgr by Employee", "Customer Project Manager", "Dealer Project Manager"]);

    The last variable, 'AdminToolAllowed' is the only variable that is working. I would like to keep them global variables because I want the user to be able to add and remove things from the list in one of my Pages on my app. I do not receive any errors for the code above, but the variables are not being set.
     
  • MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    I am in the edit Mode.
     
     
     
    In the variables section, all the values are reflecting in the global variable sections.
     
     
    In you edit mode you also experiencing the same or even in the edit mode this is not working?
     
     
  • Verified answer
    MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    I have work around for this, Instead of creating the multiple global variables i created one collection as shown below (App on Start).
     
    Note : This is sample collection only didn't add all the data.
     
    ClearCollect(
        MyCollection,
        [       
           
    //MineAllowed
           {
                Scope: "NAMESubRegions",
                Title: ""
            },
           {
                Scope: "NAMESubRegions",
                Title: "Surface"
            },
            {
                Scope: "NAMESubRegions",
                Title: "Surface & Underground"
            },
            {
                Scope: "NAMESubRegions",
                Title: "Underground"
            },
           
    //RegionsAllowed
    {
                Scope: "RegionsAllowed",
                Title: "Australia Asia & Magnolia"
            },
            {
                Scope: "RegionsAllowed",
                Title: "Canada"
            },
            {
                Scope: "RegionsAllowed",
                Title: "China"
            },
           
    //FunctionsAllowed
    {
                Scope: "FunctionsAllowed",
                Title: "Other"
            },
           
    //AdminToolAllowed
    {
                Scope: "AdminToolAllowed",
                Title: "Admin Message"
            },
            {
                Scope: "AdminToolAllowed",
                Title: "Project Types"
            }
        ]
    );
     
     
    In the drop down you can do this.
     
     
     
    🏷️ 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.
  • GP-29041548-0 Profile Picture
    12 on at
    @MS.Ragavendar , 

    When I look at my variables, only my AdminToolAllowed is under the 'Global Variables'. The rest of them are located under 'Collections'. 

    I believe this could be my problem. Do you know how to fix this?
  • MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    Sounds interesting, never experienced this kind of issue before. 
     
    Quick check
    • Cut all the variables in the App on Start ( save the variable for reference in the notepad). 
    • Run the app on start again 
    • Save t& publish the app (errors will come no worries)
    • Reload the app.
    • Now paste the values of set variable save and click app on start ( I believe this will sort our the issue.)
    If this issue not solved, as i mentioned below create one collection as shown and filter the records based on the condition.
     
     
    🏷️ 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.
  • MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    Is the issue sorted out or still facing the challenge?
     
     
    🏷️ 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.
  • GP-29041548-0 Profile Picture
    12 on at
    @MS.Ragavendar

    The issue was not solved but I am taking a different approach to avoid this problem.

    Thank you for all of your help!

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard