web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Is the current user's ...
Power Apps
Answered

Is the current user's name in a collection

(0) ShareShare
ReportReport
Posted on by 91

Hi all, 

I have a gallery. When I select a record it builds a collection of the "ReportOwner" data from Sharepoint where the ID matches - this is a multi-select person field. 

I then need to check whether the the current logged-on user name appears in that collection, this will then determine whether I make another field available to edit, or just to view.

 

The collection code I have as:

ClearCollect(colRepOwners, Filter(ERR_ComplianceData, ID = gal_reportregisterdetailed_data.Selected.ID).ReportOwner);
Clear(colRepOwnersList);
ForAll(colRepOwners, Collect(colRepOwnersList, ReportOwner));

This  collection has a column named "ReportOwner"

 

Can anyone advise though what code I need on the DisplayMode of the other field? I was hoping it was something like this, but this is invalid. 

If(LookUp(colRepOwnersList, User().FullName in ThisItem.ReportOwner, Parent.DisplayMode, DisplayMode.View)

 

Many thanks!!

Paul

 

 

Categories:
  • mmollet Profile Picture
    3,187 on at

    Try If(IsBlank(LookUp(colRepOwnersList, User().FullName in ThisItem.ReportOwner), Parent.DisplayMode, DisplayMode.View)

     

    Lookup returns the first item it finds so if it doesnt find an item then it doesnt exist. Have not tested this but worth a try and is a quick test on your end.

  • Spamrancher Profile Picture
    345 on at

    Instead of Parent.DisplayMode, I think you need DisplayMode.Edit.

  • paulbruen1603 Profile Picture
    91 on at

    Thanks, but it's actually the lookup bit that is the issue.

  • paulbruen1603 Profile Picture
    91 on at

    Thanks @mmollet, but unfortunately that wasn't valid.

  • Verified answer
    paulbruen1603 Profile Picture
    91 on at

    Ahhh, sorted it. I had it initially looking at the wrong column in the collection. It needed to look like this:

      

    If(CountRows(Filter(colRepOwnersList, User().FullName in DisplayName))>0, Parent.DisplayMode, DisplayMode.View)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard