cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ash2
Helper II
Helper II

Custom Login

Hi All,

 

I'm trying to create a user login function in my app by looking at a SharePoint list or a data table of user and password i have created.

 

but when I use the function to see if the username/password is equal the username/password that's entered in the app, it dont not seems to work. 

 

If(And('SP.Username_Column1'=PA_LS_Username.Text,'SP.Passwrod_Column1'=PA_LS_Password.Text ),Navigate('Home Screen'),Navigate('Failed To Login Screen')) 

 

should i be using another method or is the function im using is incorrect ? 

17 REPLIES 17

@yashag2255 

 

They both Text fields (single-line text)

 

 

 

g225 SP.username.JPG

yashag2255
Dual Super User II
Dual Super User II

Hey @Ash2 

 

The Screenshot added by you says that the name of attribute is SP.Username but the formula uses, Username_Column1 as the column name, are you performing any operations on the data(like column rename on the collection)? If not, please follow the convention as:
 
If(LookUp('User Info','SP.Username'= TextInput1.Text).'SP.Password' = TextInput2.Text,Navigate('Home Screen'),Navigate('Failed to login screen'))
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

The formula is using the data table that was I added to the app. 

 

sadly it's giving me the same error, how would you set up a list/data table to hold user info to log into an app?

same error.JPG

yashag2255
Dual Super User II
Dual Super User II

Hi @Ash2 

 

TextInput1 and TextInput2 needs to be replaced with the controls that you are using for entering the Username and Password. I didn't get the point of using a data table to reference this data. You can create a collection o App Start which contains the login information directly from the data source.
 
Expression: App -> OnStart -> ClearCollect(CollectionName, DataSOurceName)
 
This will copy all the values from list to collection and in the lookup formula, instead of using the data source, you can directly use this collection.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

sorry about that, it's still giving me the same issue.

 

it seems like the PA_LS_Username.Text nor the 'SP.Username' is being picked up. 

 

New2.JPG

yashag2255
Dual Super User II
Dual Super User II

Hi @Ash2 

 

Can you please confirm if the name of PasswordColumn is SP.Password? It seems that the error is on the column name.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

it seems to have 2, I tried both of them with the formula you gave before and it still has an issue picking up that column.

 

ThisItem.'SP.Username'

SP.Username_Column1

 

Untitled.png

yashag2255
Dual Super User II
Dual Super User II

Hey @Ash2 

 

Can you share more details about the use of data table? What is in the  data source for it? 
 
If you do not want user to see this screen and you are using this screen just to get the details in the offline capability, I would suggest you to remove this data table and instead collect all the data in a collection, which can be used once the app is offline. To collect data in collection or showing that in a data table requires the app to be connected to internet so that they can fetch data from the data source. Once this is done, even if the internet goes down, collection will be able to support you with the data until the app comes back online.
 
To do so:
 
Expression to be placed on "OnStart" property of the App: ClearCollect(UserInfoCollection,'SP List Name')
 
The highlighted part needs to be replaced with the actual name of SP list. This will fetch all the columns and records into this collection. This will load data once the app is opened. To run this while you are still in app, you need to select the three dots on the "App" just before your "Login Screen" on the left side tree menu and select "Run OnStart". This will get the values in the collection.
 
Now, the expression to be used on the Login button "OnSelect" property:
If(LookUp(UserInfoCollection,'SP.Username'= TextInput1.Text).'SP.Password' = TextInput2.Text,Navigate('Home Screen'),Navigate('Failed to login screen'))
If(LookUp('User Info','SP.Username'= TextInput1.Text).'SP.Password' = TextInput2.Text,Navigate('Home Screen'),Navigate('Failed to login screen'))
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (81,368)