Filter a list element based on logged in user

118
2
Jump to solution
07-08-2022 10:01 AM
Becca_Settele
New Contributor II

Hi,

I'm trying to create a list element in a dashboard where it filters out the records created by the logged in user. The data for this list element is a related table that is the result of staff entering in project reviews (called staffinput). My end goal is a list element that only shows the project reviews they submitted in the embedded survey123 form in the dashboard. 

I've got the first part of the data expression where I use FeatureSetByPortalItem to locate the table but can't quite figure out how to filter this staffinput table based on the user that is logged in. I thought a filter statement would do the trick, but I'm realizing I'm not sure how the expression will recognize which created user is logged in. 

Is this even possible in dashboards?

Here is a snip of the data expression below:

Becca_Settele_1-1657299592317.png

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Notable Contributor

It's actually very simple. We use this functionality ourselves, for a very similar process. In Arcade, the function is called GetUser. It returns a dict, so you'll need to pull out the username from that.

var curr_user = GetUser(portal)['username']

var fsFiltered = Filter(fs, 'created_user = @curr_user')
- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
2 Replies
jcarlson
MVP Notable Contributor

It's actually very simple. We use this functionality ourselves, for a very similar process. In Arcade, the function is called GetUser. It returns a dict, so you'll need to pull out the username from that.

var curr_user = GetUser(portal)['username']

var fsFiltered = Filter(fs, 'created_user = @curr_user')
- Josh Carlson
Kendall County GIS
0 Kudos
Becca_Settele
New Contributor II

Thank you @Josh!!! This is exactly what I was looking for. Works great!

0 Kudos