Create an Environment Variable in Power Apps.

Copper Contributor


I am making a Canvas Application in Power Apps in which there arose a situation where I have to make use of environment variables.


As far as I know, after referring multiple blogs and videos, environment variables when created, are stored in the Solutions Sections of the Power Apps, which makes use of the Data Verse, which I don't require.


Is there any way/approach through which I can make a custom defined environment variable, in Power Apps, without storing it in the Solutions Section? Or are there any workarounds of the same?


Thank you.

2 Replies

Here is a workaround using SharePoint
1. Create a SharePoint list (name it as AppSettings) with a column for each variable you want to configure. For example, "Server", "Version", "Url", etc.

2. Add a single record with the values for each variable
3. From Power Apps, add a SharePoint data source to the list
4. In App->OnStart(),

Set(varAppSettings, First(AppSettings)); //Load the values to a variable

5. Now you can access different environment specific values from the app like varAppSettings.Server, varAppSettings.Version, varAppSettings.Url 

The simple answer to your question is no. Environment variables all reside within a solution and require the Dataverse as Environment Variables are stored in Dataverse tables. So if you do not have a Dataverse database in your environment you cannot have Environment variables regardless of solutions. I would highly recommend looking into the use of solutions, but maybe a future endeavor.
With that said, what @ManiLive replied earlier is a good alternative to using Environment Variables.

I hope this helps.