Showing results for 
Search instead for 
Did you mean: 
Advocate III
Advocate III

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.

Not applicable

@iAm_ManCat is this your forte?

Super User
Super User

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
Super User

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

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,027)