I want to check if the current user is in a sharepoint list called "Assignees"
The List Assignees has two columns:
User (People)
Job Types (Choice)
I'm not quite sure how to approach this? Do I have to pull out the Assignee emails into a collection or something first?
Sorry, I'm more of a PHP person than a powerapps person! Not quite sure how to frame my question.
Hi @Anonymous ,
Yes - firstly something fundamental - rename the field User to something else - this is a reserved word.
So assuming now you have two fields UserName and JobType in your list Assignees - at App OnStart
Set(
vUserName,
User().FullName
);
ClearCollect(
vAssignees,
Assignees
);
Set(
vJobType,
Lookup(
vAssignees,
Lower(UserName) = Lower(vUserName),
JobType
)
);
Set(
vInList,
!isBlank(vJobType)
)
Out of this you will have
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks for your reply.
What I actually ended up doing was this:
Set(varUserEmail, User().Email);
If(CountRows(Filter('Assignees',varUserEmail in User.Email)) > 0,Set(varUserAssignee,true),Set(varUserAssignee,false));
Would there be any reason why your solution is better than mine in terms of best practice? If so I could give it a go.
Hi @Anonymous ,
If you don't want the job title, CountRows on a Filtered list has the same effect as !IsBlank() on a Lookup - it is up to your preference. Neither are Delegable (neither is In), which is why I always do a collection to get rid of the annoying warning. You can shorten yours a bit (a boolean expression will automatically set a Boolean Variable to the same result) - also you can avoid In - I am assuming that are the same text - Lower() avoids case sensitive issues, but again is not Delegable. Note also below the reference to the list field name for the user's mail.
Set(varUserEmail, User().Email);
Set(
varUserAssignee,
CountRows(
Filter(
'Assignees',
UserEmail = varUserEmail //this needs to be the name of the field in the list
)
) > 0
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
User | Count |
---|---|
126 | |
87 | |
84 | |
75 | |
69 |
User | Count |
---|---|
214 | |
178 | |
140 | |
105 | |
83 |