My 5 Top Best Practices for Developing Power Apps

So when it comes to developing Canvas Apps, the result we achieve really can be achieved through many different development practices. The question to ask yourself when developing a solution isn’t only how it will work for the end user, but also how you… READ MORE [https://lewisdoes.dev/blog/my-
My 5 Top Best Practices for Developing Power Apps
exc-62c81d3dc6414c6efd1ce92c
In: Low Code Lewis Content 🚀

So when it comes to developing Canvas Apps, the result we achieve really can be achieved through many different development practices. The question to ask yourself when developing a solution isn’t only how it will work for the end user, but also how you contribute to application lifecycle management when developing, and whether your development is easy to understand for another developer to pick it up if necessary.

In order to make sure our development is easy to understand for other developers, there are a number of best practices we can follow… here’s 5 of my favourites!

#1 – Theming

When we add controls to our app, we generally want to change up the UI to make the colours fit a theme or a brand we’re complying with. The trouble with this is that if our brand changed or our requirements became different, it’d be an enormous job to go through our app and change every controls colours and theming. To take a better approach to theming across our app, we can define our theme in our App OnStart property. First we want to define our colours, and then we can define a theme using those colours.

To define a variable with the colours we want to use we will use a syntax like this:

To define a variable with the colours we want to use we will use a syntax like this:

Set( varColours, { DarkBlue: ColorValue("#1c2d47"), MidBlue: ColorValue("#0066AF"), LightBlue: ColorValue("#41B6EB"), DarkGrey: ColorValue("#4D5054"), MidGrey: ColorValue("#B1B3B3"), DarkYellow: ColorValue("#F7A800"), Green: ColorValue("#99BD12"), Purple: ColorValue("#9D1D96"), Turquoise: ColorValue("#71DBD4"), Orange: ColorValue("#F26703"), Teal: ColorValue("#005E62"), TransparentWhite: RGBA(255, 255, 255, 0.5), White: White }

Here you can see we are defining our variable for the colours we want to use in our app, then we’re defining a variable for our theme with multiple tables in it to manage the colours of different things we have in our application and their properties.

You can see I have defined some elements of a popup and a form. I will then use these variables in the colour and text size etc properties of each of my controls, then when I need to change my brand, I can simply change the theme in my OnStart and run OnStart to see my changes take effect!

Set( varTheme, Popup: { ContentOverlay: varColours.TransparentWhite, BackGround: varColours.LightBlue, Header: { Colour: varColours.White, Weight: Bold, Size: 26 }, Label: { Weight: Bold, Size: 12, Colour: varColours.White }, Text: { Weight: Normal, Size: 12, Colour: varColours.White } }, Form: { RequiredMarker: {Colour: varColours.Orange}, Label: { Size: 12, Height: 22, Weight: Bold, Colour: varColours.DarkBlue }, Data: {Outline: varColours.LightBlue} )

#2 – Multiple App Solutions

Do you have really big solutions that you have to build? An enormous use case? Perhaps an entire CRM?

In these cases sometimes we try to build an app that can do multiple things. We might do lots of things to make this possible, such as making it completely responsive for both phone and desktop, or we might pack LOADS of features into it… but that becomes pretty big and complex! Also remember there are limits to how many controls we should be adding to our applications before they start to slow down!

In these cases, you might find that it works really well to split your solution into multiple applications for the user interface element.

A really good example of this is Dynamics 365 Customer Engagement which is split into various applications such as Sales, Customer Service, Project Operations and more.

#3 – Prevent Solution Layering with Environment Variables

Do you ever have those things that might need to be different in a production environment, perhaps a SharePoint site URL, a Dataverse queue ID? Now… PLEASE DO NOT make these changes in production! You will create active solution layers in your solution which means that future upgrades won’t apply properly until these layers are deleted… this can become pretty untidy!

Instead of doing this, we can make use of environment variables… and yes, they are literally what they say on the tin! A variable you can reference across your entire environment… in your applications and flows! So, simply create an environment variable for these scenarios and watch it appear in your app’s data source and flows dynamic content.

Need to use an environment variable in your Power Fx? Simply use a Power Apps button flow with a compose action with your environment variable dynamic content in it, then pass it back to Power Apps as an output! There you go, set that output as a variable in your app and you have your environment variable!

#4 – Solution Deployment with a Service Account

When it comes to deploying your solution, the account that imports the solution to your target production environment, will be the created owner of the resources and objects you import. We need to make sure this account is always going to be active for as long as the solution is in use. Therefore, this best practice tip is to use a service account to deploy your solutions to production.

That way, when said developer leaves the organisation we don’t need to go through the panic of ‘oh no… no-one owns my flow!’

#5 – User Acceptance Testing and Opinion Collection

So, before we attempt to get a large group of users to adopt our application, it’s important that they WANT to do this before we try to get them to do it! There are many things that can affect user adoption such as:

✅ Lack of UAT leading to potential application issues and bugs

✅ Missing needed features

✅ Unimpressive user interface and experience (UI/UX)

✅ Inaccessible applications – Instantly blocks out a group of users who cannot use the application

Therefore to mitigate these potential issues, we must ensure we carry out sufficient user acceptance testing and opinion collection. This allows us to gain opinions from our user base and make changes to improve our application so that our users will like it more, which leads to better usage and increased user adoption.

If you need help with User Interface/Experience and Accessibility in your applications – Kristine Kolodziejski is your queen on these topics… and many many more! 👑

Written by
Lewis Baybutt
Microsoft Business Applications MVP • Power Platform Consultant • Blogger • Community Contributor • #CommunityRocks • #SharingIsCaring
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to LewisDoesDev.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.