How get the groups of current user

361
2
Jump to solution
11-03-2022 02:22 PM
lmotta_ibama
New Contributor II

I would like to get the groups that user of Survey123 belongs to.

I can get the "username" using pulldata("@property", "username"), but, I not found how to get the user's groups from this document [1].

I need this information to filter the data from the survey layer in a Dashboard, where the Dashboard user can only see the features that were generated by the users of the same group.

Here the idea:
1) Record the name of the group the user belongs to in Survey123.
2) In Dasboard using Arcade, get a list of all the users in the same group that the Dasboard user belongs to.
With this list create the filter

I appreciate any help.


[1] https://doc.arcgis.com/en/survey123/desktop/create-surveys/prepopulateanswers.htm

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
lmotta_ibama
New Contributor II

Hello @ZacharySutherby ,

The problem for use of REST endpoint by JS, the Survey will be work offline.

Identify after send by ArcGIS API for Python, it is good, but, need more develop, at the moment I need a direct solution.

I will create a CSV with the "username" and "staff_census", with this, I can get the "staff_census" by the "username", pulldata("@property", "username"), and save in the Survey's field.

For dashboard, I read the "staff_census" of portal user, and filter all data by "staff_census".

Than, I don't need use the group of user.

Thanks you,
Luiz Motta

View solution in original post

0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @lmotta_ibama

Survey123 doesn't have a property to extract users groups, one option would be to use a custom JavaScript function to call the User Self REST endpoint which will return the groups the user belongs to. 

If your survey is planned to be shared with folks outside your organization another option would be post process the data after it's submitted using the ArcGIS API for Python to identify what groups the user belongs to and amend the record. 

Thank you,
Zach
0 Kudos
lmotta_ibama
New Contributor II

Hello @ZacharySutherby ,

The problem for use of REST endpoint by JS, the Survey will be work offline.

Identify after send by ArcGIS API for Python, it is good, but, need more develop, at the moment I need a direct solution.

I will create a CSV with the "username" and "staff_census", with this, I can get the "staff_census" by the "username", pulldata("@property", "username"), and save in the Survey's field.

For dashboard, I read the "staff_census" of portal user, and filter all data by "staff_census".

Than, I don't need use the group of user.

Thanks you,
Luiz Motta

0 Kudos