[UI-Designer] Display Rest API result in dropdown list
Hello everyone,
I'm in front of a problem when i want to display users in a dropdown.
In UI-Designer, i have create an "External API" varriable with this url : '../API/identity/user?f="enabled"=true'
When i'm display this variable, it's show correctly:
{{usersAPI}} ==>
[{
"firstname": "Studio",
"icon": "icons/default/icon_user.png",
"creation_date": "2018-03-20 15:59:07.936",
"userName": "studio",
"title": "",
"created_by_user_id": "-1",
"enabled": "true",
"lastname": "",
"last_connection": "",
"password": "",
"manager_id": "0",
"id": "22",
"job_title": "Studio technical user for preview",
"last_update_date": "2018-03-20 15:59:07.936"
},....
]
So, in my dropdown list I fill attribute like that:
'available values' = users
'display key' = userName
'return key' = id
But, when i did it, my dropdown show the entire line of user:
{"firstname":"Studio","icon":"icons/default/icon_user.png","creation_date":"2018-03-20 15:59:07.936","userName":"studio","title":"","created_by_user_id":"-1","enabled":"true","lastname":"","last_connection":"","password":"","manager_id":"0","id":"22","job_title":"Studio technical user for preview","last_update_date":"2018-03-20 15:59:07.936"}
I allready try with :
'available values' = users | json
In this case, my dropdown show all characters....
Someone can help my about this ?
Thanks
Thx for your reply,
I have found the solution, and it's ridiculus...
In Bonita UI, when you create a 'dropdown', you can use 'fx' or 'X' in keys.
'fx' take a function or a part of your object, and 'X', just takes a cosntant.
So, when I'm selecting 'fx', the dropdown just work perfectly... It was a mistake who can use lot of time.
Comments
Do you confirm that your "External API" variable is named "users"? If yes, maybe something wrong between "users" and "usersAPI"?
"usersAPI" it's an ExternalAPI.
"users" is just a test who are getting the result of usersAPI and try to transform to JSON object.
At the end, usersAPI = users.
But i have found the solution, i will write it after this post.