cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Verify if User() exist in the SP list

Hello everybody!

 

I want to verify if current user occur in the SP list. I tried some ideas but without positive results.

 

If(LookUp(List; User().FullName in Person.DisplayName; Person.DisplayName) = User().FullName; Navigate(Screen; Fade); Set(Incorrect;"You are not member!"))

 

Also I tried to use CurrentUser method but it doesn't working also. 

 

Thank a lot for Yours answers!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

If(CountRows(Filter(Members,Person = User().FullName)) > 0, Navigate(Screen, Fade), Notify("You are not member!"))

 

Please change the Screen to your screen name

View solution in original post

12 REPLIES 12
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Firstly, you will have a delegation issue with User()>FullName. The workaround is to set a Variable

Set(vUser,User().FullName)

There is also a delegation issue with In - so try this:

If(
   !isBlank(
      LookUp(
         List, 
         vUser = Person.DisplayName
      ),
      Person.DisplayName
   ),
   Navigate(Screen,Fade), 
   Set(Incorrect,"You are not member!")
)

Pardon the commas - semi-colons mean a new command for me.

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

kbilakanti
Resolver II
Resolver II

@Anonymous  If(LookUp(List, <FieldName in list>= User().FullName),true,"Error")

Anonymous
Not applicable

@WarrenBelz 

 

It doesn't work, there is error ( red marks)

 

If(!IsBlank(LookUp(List; vUser = Person.DisplayName); Person.DisplayName);Navigate(Screen; Fade); Set(Incorrect;"You are not member!"))

 

= -> incorrect type of argument

Person.DisplayName -> also here is something wrong

Anonymous
Not applicable

@kbilakanti 

 

Unfortunately is also doesn't work

Hi @Anonymous ,

I was trying to give you some guidance on a process using the field names you supplied (which is the bit not working). What I was pointing out is the delegation issues with In and User().FullName. Can you please give me

  • The name of the list containing the user’s name
  • The field name in the list containing the name.

As an example, if the list name is Person and the field name is DisplayName then

If(
   !isBlank(
      LookUp(
         Person, 
         vUser = DisplayName
      ),
      DisplayName
   ),
   Navigate(Screen,Fade), 
   Set(Incorrect,"You are not member!")
)

should work after you set the Variable vUser to User().FullName

 

Please what is the name of your table (Is it SPList) and what is the name of your Column/Field that holds your user names in your database. Being Clear on this will help

Anonymous
Not applicable

@WarrenBelzand @kbilakanti 

 

List name : Members

 

Ther is just one column called "Person" and set as "Person or Group"

If(CountRows(Filter(Members,Person = User().FullName)) > 0, Navigate(Screen, Fade), Notify("You are not member!"))

 

Please change the Screen to your screen name

Hi @Anonymous,

Thanks for clarifying that. In my last post I catered for a text field assuming the previous one did not work for this reason.

OK - I do not use this field type myself, however I assume that it is no different from any other complex field type with a table structure.

I will try another approach assuming you have less than 2000 items in Members.

ClearCollect(
   colMembers,
   Members
);   //put it all in a collection

If(
   User().FullName in colMember.Person,
   Navigate(Screen,Fade),
   Set(
      Incorrect,"You are not member"
   ),
)

There are no delegation issues querying a collection, so you can go back to the old operators.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,187)