# Users Dropdown List

**URL:** <https://forum.inductiveautomation.com/t/users-dropdown-list/59057>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [April 29, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057 "2022-04-29T15:10:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 29, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/1 "2022-04-29T15:10:58Z")

</div>

Trying to create a list of users to choose from to make login easier on a touchscreen. Having an issue. My `user.Username` property is coming in as “username” for all users. Here is the setup:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/1/d14ce055ddf1c831c59ab21a8116081a89a50955.png)

Custom dataset property on a popup window named “users”

on-window-open script:

```auto
userList = []

users = system.user.getUsers("")
for user in users:
	if user.Username != "admin":
		userList.append(user.Username)

userDataSet = system.dataset.toDataSet([''],[[x] for x in userList])

system.gui.getParentWindow(event).getComponentForPath('Root Container').users = userDataSet
system.gui.getParentWindow(event).getComponentForPath('Root Container').password = " *****"

```

The user dataset property is then bound to the data property of the dropdown box.

This is my result:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/b/2bad0fc2baecfbc5ef68438691bbfe92a73e9f65.png)  
(I’ve also added a temporary table to see the dataset with the same data binding as the dropdown list)

Why do I get “username” for all of the users?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [April 29, 2022, 3:35pm UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/2 "2022-04-29T15:35:14Z")

</div>

maybe try `userList.append(user.get('username'))`. That’s how the example in the docs shows fetching properties from a user object

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 29, 2022, 3:52pm UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/3 "2022-04-29T15:52:18Z")

</div>

> [@amarks](#):
>
> Why do I get “username” for all of the users?

[`User`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.16/com/inductiveautomation/ignition/common/user/User.html) is an interface that extends [`PropertySet`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.16/com/inductiveautomation/ignition/common/config/PropertySet.html), which is basically a multi-type map we use all over the place in Ignition.

The User _interface_ defines various static property methods that are used elsewhere in Ignition to retrieve user attributes in a type-safe manner. Those interface constants are carried down to each _instance_ of the User class, so the (probably) [`PyUser`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.16/com/inductiveautomation/ignition/common/user/PyUser.html) that you ultimately get in your script has those defined as fields.  
Note these two methods on PyUser:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a738173d417674bccde1ff880b0e4fac95c25676.png)

You can either call `user.get(user.UserName)` to use the first method, or `user.get("username")` to use the second method - which will simply look through the object's defined properties looking for a property with the given name (this means the first method is technically more efficient, but it's unlikely to ever really matter).

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 29, 2022, 3:52pm UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/4 "2022-04-29T15:52:27Z")

</div>

That seems to have worked, but the documentation for `system.user.getUsers` is not super clear.

[https://docs.inductiveautomation.com/display/DOC/system.user.getUsers](https://docs.inductiveautomation.com/display/DOC/system.user.getUsers)

```auto
You can access most of the basic user properties via a call to "get" or "getOrDefault" which returns a default value if the requested item is not present. For example:

user.getOrDefault(User.Schedule)

...will return that user's schedule, or the value of "Always" if no schedule has been set as that is the default schedule. The following are the various values you may use in this manner:

User.Username
User.FirstName
User.LastName
User.Notes
User.Schedule
User.Language
In addition to these properties, the user object has other methods on it to retrieve more information:

User.getId() - returns the internal identifier object that the backing user source needs to identify this user
User.getRoles() - returns a sequence of strings representing the roles that this user belongs to
User.getContactInfo() - returns a sequence of ContactInfo objects. Each of these objects will have a contactType and valueproperty representing the contact information, both strings.
User.getScheduleAdjustments() - returns a sequence of ScheduleAdjustment objects. Each of these objects will have two date properties, "start" and "end", a boolean property, "available", and a string property called "note".
User.getPath() - returns a QualifiedPath object that represents this user in a deterministic manner.

```

---

<div class="post-metadata">

**Author:** ![jmorris](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jmorris](https://forum.inductiveautomation.com/u/jmorris)\
**Post date:** [May 22, 2023, 3:58am UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/5 "2023-05-22T03:58:05Z")

</div>

I'm able to access the properties, but how do you access the methods?  
Thanks!

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 22, 2023, 4:20am UTC](https://forum.inductiveautomation.com/t/users-dropdown-list/59057/6 "2023-05-22T04:20:13Z")

</div>

> [@jmorris](#):
>
> how do you access the methods

I'm afraid I don't understand this question. Methods are used in scripting along with fields, and they vary from class to class. What specifically are you wanting to do?
