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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Implementing Role-Base...
Power Apps
Unanswered

Implementing Role-Based Login Screen using Dataverse in Power Apps

(1) ShareShare
ReportReport
Posted on by 2

Hi there,
Good day!  I'd like to share with you a solution I've been working on: a Role-Based Login Screen using Dataverse tables within Power Apps.

Here's a breakdown of the process I followed:


Role Table Creation: I started by creating a 'Role' table with the following columns:

  • id: Unique identifier for each role.
  • RoleName: The name of the role (e.g., 'Admin', 'User').


AsaadBLK_3-1692695047621.png

 

User Table Setup: Next, I set up a 'User' table with columns such as:

  • idUser: Unique identifier for each user.
  • login: User's login name.
  • password: User's password.
  • Role: Foreign key referencing the 'id' in the 'Role' table.


AsaadBLK_1-1692694856178.png


Login Screen Design:
I designed a login screen with input fields for the user's login and password, along with a login button.

AsaadBLK_0-1692694777547.png

 


Login Logic: Here's the code I used for the login button's 'OnSelect' property:

If(
!IsBlank(
LookUp(
'User Entitys',
login = TextInput1.Text And password = TextInput1_1.Text And (Role = 1 Or Role = 2)
)
),
Navigate(
Assignment,
ScreenTransition.None,
{LoggedInUser: TextInput1.Text}
)
)

The code checks if the entered login and password match a user in the 'User Entitys' table with a role of either 'Admin' (Role = 1) or 'User' (Role = 2). If a match is found, it navigates to the 'Assignment' screen while passing the logged-in user's login as a parameter.

I hope this example provides some insight into creating a Role-Based Login Screen using Dataverse tables in Power Apps.
Feel free to customize and adapt it to your specific project needs. 

Best regards,

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    Thanks @AsaadBELK.

     

    This is a good idea and certainly workable for something like SharePoint, but given Dataverse has role based security available out of the box, why create a separate entity instead of simply identifying the security role the user has been assigned?

     

    For example, I would use the below on the OnStart property of my App to identify if a user belongs to a specific custom security role.

     

     

    Set(
     IsApprover,
     With(
     {
     userRole: Distinct(
     LookUp(
     Users,
     'Primary Email' = User().Email
     ).'Security Roles (systemuserroles_association)',
     Name
     )
     },
     "Document Approver" in userRole
     )
    )
    

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard