Power Apps Different Home Screen Based On Different User

Would you like to know if Power Apps allows us to customize home screens for each user? Yes, this Power Apps tutorial will cover how to alter the home screen in the Power Apps Canvas app according to the different users.

Different Home Screen Based On Different User Power Apps

Let’s get started with step-by-step instructions for how to fulfill this desire.

Step – 1:

  • First, use the verified login information to access Power Apps. Go to + Create and select the Blank app under Start from.
PowerApps Different Home Screen Based On Different User
PowerApps Different Home Screen Based On Different User

Step – 2:

  • You can create various apps in Power Apps, including the Blank canvas app, Blank app based on Dataverse, and Power Pages website, which are all displayed on the Create page. Select the Blank canvas app and click on Create.
Power Apps Different Home Screen Based On Different User
Power Apps Different Home Screen Based On Different User
  • Give the app a distinctive name (Different Home Screen depending on current user) and select either a Tablet or a Phone as the Format. Select Create.
Different Home Screen Based On Different User in Power Apps
Different Home Screen Based On Different User in Power Apps

Step – 3:

  • The new canvas app will open with Screen1 as its default screen. Next, we must determine how many screens to make based on the number of users.
  • For example, let’s say I have a total of three users from the SALES, IT, and FINANCE departments. I must make three distinct screens in Power Apps for three distinct users in order to achieve this.
  • For this purpose, I have created three different screens i.e. SalesScreen, ITInfoScreen, and FinanceDetailsScreen.
Different Home Screen Based On Different User Power Apps
Different Home Screen Based On Different User Power Apps
  • The Power Apps screen will therefore be visible to them depending on the users. For example:
  1. Only those employees who are available under the SALES department can see the SalesScreen.
  2. Only those accessible under the IT department can see the ITInfoScreen.
  3. Only those available under the FINANCE department can see the FinanceDetailsScreen.
See also  PowerApps send email on submit

The below screenshot represents all the Power Apps Home Page screens that I have created.

Power Apps Different Home Screens Based On Different User
Power Apps Different Home Screens Based On Different User

Step – 4:

  • The app will then be connected to the Office 365 Users connectors. To add it, go to the Data tab -> + Add data -> Search Office 365 in the search bar -> Select Office 365 Users. The connector will appear below once you’ve added the connection to the app.
PowerApps Different Home Screens Based On Different User
PowerApps Different Home Screens Based On Different User

Step – 5:

  • Next, apply the code below on App’s OnStart property:
OnStart = Set(vName, Office365Users.MyProfile().Department);
If(
    vName = "SALES", Navigate(SalesScreen, ScreenTransition.None),
    vName = "IT", Navigate(ITInfoScreen, ScreenTransition.None),
    vName = "FINANCE", Navigate(FinanceDetailsScreen, ScreenTransition.None))

Where,

  1. vName = Variable name
  2. Office365Users.MyProfile().Department = It will retrieve the department of the current user.
  3. SALES“, “IT“, “FINANCE” = Department names
  4. Navigate = Power Apps Navigate function helps to redirect from one screen to another screen.
power apps show screen based on user
power apps show screen based on user
  • But there will be an issue after we will apply the code on App’s OnStart property. You would receive troubles in the studio if you tried to use Navigate() in OnStart:

Navigate is not permitted in OnStart. Use the StartScreen property instead.” (Refer to the above screenshot)

  • We will switch to the StartScreen property and write the exact code because the error suggests applying the above code to the App’s StartScreen property.
  • However, suppose we apply the code to the StartScreen property. In that case, we will also encounter an error similar to the “Behavior function in a non-behavior property. You can’t use this property to change values elsewhere in the app.” as below.
navigate is not permitted in onstart powerapps
navigate is not permitted in onstart powerapps

Step – 6:

  • Further research on this mistake led me to a solution that required me to enable an outdated feature under the settings menu. The navigate feature will operate on the app’s OnStart property after we enable it.
  • To enable this feature, go to Settings (top of the page) -> Select Upcoming features -> Click on the Retired tab -> Enable Navigate function in App.OnStart. Then close this page.
powerapps show screen based on user
powerapps show screen based on user

Step – 7:

  • Save the app now, then publish (publish this version). The feature will not function if you choose not to publish the app. Therefore, once the app has been activated, make sure to save and publish it.
power apps hide screen based on user
power apps hide screen based on user
  • Apply the same code once more to the app’s OnStart property after reopening it. However, it will still display a warning message like the previous one “Navigate is not suggested in OnStart, Use the StartScreen property instead for better performance“. But, the code will now function as needed.
Different Home Screen Based On Different User PowerApps
Different Home Screen Based On Different User PowerApps

Step – 8:

  • Save and publish the app once more. You can access Power Apps using several accounts (for testing purposes) and view the particular screen for a specific user.
  • You must first share the app with users before you can proceed (those who want to show different kinds of home screens).
  • I went to Power Apps to test the app, and when I logged in as an IT user, I was prompted to grant the Office 365 Users permission. When we gave it permission, the precise IT Info Screen depicted in the figure below appeared.
how to make Different Home Screen Based On Different User Power Apps
how to make Different Home Screen Based On Different User Power Apps
  • Similar to this, the Sales and Finance teams’ respective home screens appeared when I logged in to Power Apps for those users.
Create Different Home Screen Based On Different User Power Apps
Create Different Home Screen Based On Different User Power Apps

This is how we can build Power Apps Different Home Screen Based On Different Users.

See also  Dataverse Solution [Complete Tutorial]

This is how we can create different home screen based On Different User in Power Apps. Also, we saw how to resolve this issue “Navigate is not permitted in OnStart. Use the StartScreen property instead.” while working with the Power Apps OnStart property.

Furthermore, have a look at some more Power Apps Tutorials:

>