Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Create user-defined enums in Canvas App

Is it possible to create your own enum types similar to how the built in ones work (e.g. DisplayMode, Color etc)?


As an example, I want to avoid hard coding integer values for parameters/options throughout the app which refer to related values in an external system which we integrate with.


So it would be much cleaner to define these values in a user-defined enum similar to C/C++.

Is there some editing of the manifest etc which could achieve this?


Creating a Collection or custom Component with custom properties set to specific default values could achieve this, but that's a bloated hack.

Many thanks.

Super User
Super User

@iAm_ManCat is this your forte?

Super User III
Super User III

Hi @MarrinerDev 

Although this is not exactly an enum, perhaps you could just declare a global variable of data type 'record' that stores your name value pairs?

For example, let's say you add this to the OnStart property of your app.

    {Car:1, Bus:2, Train:3}

In formula, you can then do this:



Super User II
Super User II

@timl has the right idea here - create a global variable that stores your record, have that record filled with data during the OnStart by pulling that from your external source. There are some changes you can make to the themes.json file within a .msapp file to affect color etc but not all items are picked up by the IDE when you import the file.


I built a template for automating the color properties for all objects inserted as a default here: - you could modify how I've done that to suit your needs for pulling in user-defined properties from a third-party source and the having them applied by default to all new controls added to an App.


Thanks @Eelman for the mention!


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!

You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (3,329)