I am trying to create a dataset out of all user in the active directory to be used in a perspective drop down, but I am running into a few errors.
I first created a simple script named 'getUsers':
users = system.user.getUsers("AD")
Then I bound it to the option properties on the dropdown component using the following expression:
runScript("getUsers")
However, I get the error that the expression is retrieving a string but is expecting a string/dataset. So my next step was to convert the python list into a dataset using the following script:
headers = ["User", "First", "Last", "Roles"]
data = users = system.user.getUsers("AD")
users = system.dataset.toDataSet(headers, data)
print(users)
When I do this I get the following error: "TypeError: toDataSet(): 2nd arg can't be coerced to org.python.core.PySequence"
This may be due to the structure of the list that is produced by the getUser function. When printed it displays a list in the following format:
[User[username=user, firstname=Kawsar, lastname=Ahmed, roles=[role1, role2, role3..]], User[username=user, firstname=Kawsar, lastname=Ahmed, roles=[role1, role2, role3..]]...]
Has anyone encountered something similar that may be able to help me?
Thanks!