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').
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.
Login Screen Design:
I designed a login screen with input fields for the user's login and password, along with a login button.
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,

Report
All responses (
Answers (