cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jupyter123
Helper IV
Helper IV

How do i save the user details in sharepoint who has logged in power apps through power automate

Hi . I have a question that sounds like complicated.

Let me explain.

First off, I have created a login page in power apps which contains username and password (That's page 1 in that application)

Secondly, The username and password is saved in a SharePoint list which is used to authenticate username and password. 

So after the user logins , it will navigate to second page. and in second page, i want that user name to be displayed in top right corner.

In power apps, i have wrote a code to display user details

let me show the code below

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

If( !IsBlank( LookUp( logindatabase, Title = Usernametxt.Text && Password = Passwordtxt.Text ).Password ), Navigate(Content_Generation),Reset(Usernametxt);Reset(Passwordtxt));
Set(varUserRecord, {});
Set(varUserRecord, LookUp(logindatabase, Title=Usernametxt.Text && Password=Passwordtxt.Text));
If(IsBlank(varUserRecord.ID),
Notify("Invalid username or password", NotificationType.Error, 3000),
Notify("Successful Login", NotificationType.Success, 3000);Navigate(Content_Generation, None)
)

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

So in next page, whenever user logins , i can display their name in top right corner 

"Welcome User " & varUserRecord.Title & "!"

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

Is it possible to do the same in power automate?

also, using power automate, i have to save the username in sharepoint, who has logged in. 

so how to do this process?

pls guide me in detail how to do that.

1 REPLY 1
Sundeep_Malik
Community Champion
Community Champion

Hey @Jupyter123 

 

Yes its possible to do the same in Power Automate.

 

So, whenever a person clicks on login button, you should run the flow.

 

From that button, also send the username and password.

Then with the help of condition action, check if username and password is correct or not.

If it is correct, send something to the power app, by which if it matches, it would take the user to the next screen. And also at this point store, the username of the person, to maintain who has logged in power apps.

 

If they do not match, send something to the power apps, that will not let the power app to go to the next screen, and shows a message username or password incorrect.

 

You should probably return 1 and 0.

If the returned value is 1, everything matches and you should take the user to next screen.

If the returned value is 0, username/password did not match and you should show a message that, something didnt match.

 

This is how your flow would look like:

 

Sundeep_Malik_0-1668507204645.png

 

I have added a variable, which will note that username and password matched or not. It will act like a flag variable like other programming languages.

 

Sundeep_Malik_2-1668507389441.png

 

 

Used get items to get username and password. If the flow runs really slow, then you will have to use filter query.

 

After that use a condition action and use username coming from power apps and username coming from get items, this will create an apply to each.

If the username didnt match, set the variable to 0.

Sundeep_Malik_1-1668507372470.png

If the username matches, add another condition action, to match the password.

If the password doesnt match, set variable to 0.

If the password matches, set variable to 1 and use create item, to make an entry for the user logged in.

Sundeep_Malik_3-1668507553541.png

 

At the end just add respond to power apps action and pass the match variable in it.

 

Sundeep_Malik_4-1668507593685.png

 

I hope this will help.

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,992)