# How to get users created in gateway in perspective dropdown

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 30, 2024, 7:04am UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936 "2024-01-30T07:04:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [January 30, 2024, 7:04am UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/1 "2024-01-30T07:04:27Z")

</div>

Hi Team

I have created users and roles in the gateway.  
I want that usernames in the dropdown.

here in below script I am able to get list of users.  
where I can bind in dropdown.  
Please guide.

```auto
users = system.user.getUsers('default')
print users
validUsers = []

for u in users:
# print u.getRoles()
    if 'Operator' in u.getRoles():
        validUsers.append(u.get('username'))
        
print validUsers

```

output in script console:  
[u 'user1', u 'user2', u 'user3', u 'user4']

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [January 30, 2024, 8:59am UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/2 "2024-01-30T08:59:37Z")

</div>

If you put the binding onto the options in the components props.

However for it to be valid each option needs a label and value field, in this case they'd be the same thing.

On the binding, you can put some kind of expression binding, maybe a long timer like `now(10000)`, this is just the rate at which your options will refresh. You could bind this to anything really, like the current username if you don't want it to refresh after they logged in.

Put a script transform, and add in your code above, but to get the correct format append the extra code:

```auto
....
optionList = []
for user in validUsers:
    optionList.append({'value':user,'label':user})
return optionList

```

You could also just put this into previous for loop instead

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [January 30, 2024, 5:36pm UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/3 "2024-01-30T17:36:31Z")

</div>

Thank you, I got the solution

---

<div class="post-metadata">

**Author:** ![Farheen\_Qureshi](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Farheen\_Qureshi](https://forum.inductiveautomation.com/u/Farheen_Qureshi)\
**Post date:** [August 22, 2024, 6:47am UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/4 "2024-08-22T06:47:29Z")

</div>

could you please explain where we have write this script

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [August 22, 2024, 10:36am UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/5 "2024-08-22T10:36:46Z")

</div>

where you want to display the user names.  
you can test on dropdown component

---

<div class="post-metadata">

**Author:** ![Farheen\_Qureshi](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Farheen\_Qureshi](https://forum.inductiveautomation.com/u/Farheen_Qureshi)\
**Post date:** [August 22, 2024, 1:43pm UTC](https://forum.inductiveautomation.com/t/how-to-get-users-created-in-gateway-in-perspective-dropdown/84936/6 "2024-08-22T13:43:08Z")

</div>

i want to display users in dropdown along with user email id which i have created in gateway
