web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Loading Page Based on ...
Power Apps
Unanswered

Loading Page Based on Logged-On User

(0) ShareShare
ReportReport
Posted on by 20

Hello,

 

I have created an application that has a custom login box which is referencing test data from a SharePoint list for credentials.

These credentials are:  User, Pass, and Work Area (A1,A2, etc.)

 

Once the user enters their User and Pass, the app does a "LookUp" function to ensure the user data matches the SP List.  After the match is verified, the app navigates to a loading screen and resets the original login inputs (I'm not sure if it should or should not reset??)

 

Once at the loading screen a timer automatically begins counting down before sending the user to another screen.  This is where I am running into an issue though...

 

After the app has finished "loading" I would like for the app to redirect (navigate) the user to a specific screen based on the individual's Work Area from the SP List referenced for login.  I would like to know how I make the app recognize the User that was logged in from the home screen, and redirect them to a specific screen based on their Work Area?

 

EX:

The system has two users,  Person1 and Person2.  Person1 is assigned to Work Area 1 and Person2 is assigned to Work Area 4.

 

Person1 enters password correctly, access is granted by sending Person1 to the loading screen.  Once there, Person1 should be redirected to the Work Area 1 dashboard specifically.  Person1 should not have access to Work Area 4's dashboard.

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    When you do the lookup to validate the user's login inputs just save that row as a local object. Like this:

    Set(currUser, LookUp(YourListName, **UN/PW Match**))

    Now you have the curent users object called currUser which gives you access to his/her work area. Now on select for the login button (or on timer end of your timer) you can use the following:

    Switch(currUser.WorkArea,

    "Accounting",

    Navigate(AccountingScreen),

    "Admin",

    Navigate(AdminScreen),

    "Other",

    Navigate(OtherScreen)

    )

     

    This will read the curernt users work area and navigate to the correct screen based on that.

  • TJ-25 Profile Picture
    20 on at

    Hi mmollet,

     

    Thank you for your quick reply.  I am still learning so I am a bit confused on your reply though.  Could you help me evaluate my current formula for the login button and how I should manipulate to match what you are guiding on?

    If(!IsBlank(LookUp('DATABASE NAME',Title='UserID-TextInput'.Text And Credential='Password-Input'.Text).Title),SubmitForm('UserID-Input');Set(varUserLogin,false);Navigate('Loading Screen',ScreenTransition.Fade);ResetForm('UserID-Input');Reset('Password-Input'),Set(varLoginErrorMsg,true))

     

    Essentially right now there is a login button when the app loads, once pressed it provides the input boxes to actually log in to the app housed in "varUserLogin" and if the user enters incorrect credentials the "varLoginErrorMsg" shows.

     

    I was not sure where to insert the additional formula you are referencing.

  • mmollet Profile Picture
    3,187 on at

    Sure! It looks like you are doing a few things and I will assume that you need to keep doing those things so I will add them back in the code I provide. I will do the first case and then you will have to take that and apply it to all the cases you may have. (One for each Work Area):

    // first lookup the creds entered and determine if there was a match

    Set(currUser, LookUp(YourListName, LookUp('DATABASE NAME', Title = 'UserID-TextInput'.Text And Credential = 'Password-Input'.Text))

     

    // now decide where to navigate/what to do based on the user's input

    Switch(currUser.WorkArea, // we will use the currently logged in user's work area as the switch value

    Blank(),

    Notify("Incorrect UN/PW Entered", NotificationType.Error, 2), // if blank notify the user of a data input error

    "Accounting",

    Navigate(OtherScreen, ScreenTransition.Fade), // if work area = accounting navigate to accounting screen

    "Admin",

    Navigate(AdminScreen, ScreenTransition.Fade), // if work area = admin navigate to admin screen

    "Other",

    Navigate(OtherScreen, ScreenTransition.Fade) // if work area = other navigate other screen

    )

     

    What the above should do is:

    1. Lookup function -> this will look for an entry where the UN and PW matches. Once this is done, the function will return Blank() or the row that it found the match in (the first row that is, if multiple will only find the first). This row is then saved as a global variable that holds that object.
    2. Switch Statement -> this statement takes in a value and then based on that value will 'switch' what it is doing. So if the value (work area in our case) is "Accounting" then it will navigate to the accounting screen. It should also clear the UN/PW fields on the login screen. In that case you would still need this line: Set(currUser, LookUp(YourListName, LookUp('DATABASE NAME', Title = 'UserID-TextInput'.Text And Credential = 'Password-Input'.Text) and you would also want to naviagte to the wait screen as well.

     

    Few questions now:

    What is the point of the Loading Screen? If you do need this step still then the switch statement will go on the timer's OnTimerEnd field. This will execute after the timer is over and will take the user to the correct screen. 

    What is the submit form for? Are you tracking login attempts/sessions?

    What is the varUserLogin and varLoginErrorMsg for? 

     

    You might have to add the variable for the above mentioned questions if you need them still. You will have to add the to each case based on if they are needed there or not. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard