Hi,
I have a combobox with the items based on a get call from a custom connector.
The combobox lists employees.
Based on current user logged in, I want default value to be current users initials (the letters before "@" in email address), fx MW.
Of course combobox does not want to accept a text value, because it wants a table value. How do i do this?
Items is like this: Custconnect.GetEmployees(envvarTenantid, envvarEnvironmentname, envvarCompanyid).value <- returns a collection.
A workaround would be to make a collection of the api call like:
ClearCollect(collEmployees, Custconnect.GetEmployees(envvarTenantid, envvarEnvironmentname, envvarCompanyid).value)
And then have items be collEmployees, and defaultselecteditems be something like
Filter(collEmployees, no = curuser.email)
That solution would need to run clearcollect when opening that screen, which is a call to much if the user doesn't want to use the combobox.
What is best/good solution?
Solved! Go to Solution.
Hi @MadW ,
Do you want display current user's email address initials as the combo box default selected item?
Actually, I think the solution that you provided is already the best solution.
Please notice one key point:
combo box's default selected item should be one item of the combo box's Items.
If you set combo box's DefaultSelectedItem to a value that does not exist in combo box's Items, it will not display correctly.
So the solution should be that:
save the combo box's Items as a collection, add user's email address initials in this collection
set the combo box's Items and DefaultSelectedItem based on this collection.
For example:
set the app's OnStart:
ClearCollect(collection1,Custconnect.GetEmployees(envvarTenantid, envvarEnvironmentname, envvarCompanyid).value);
Collect(collection1,{fieldname:First(Split(User().Email,"@")).Result})
set the combo box's Items:
collection1
set the combo box's DefaultSelectedItems:
Filter(collection1,fieldname in User().Email)
Best regards,
Hi @MadW ,
Do you want display current user's email address initials as the combo box default selected item?
Actually, I think the solution that you provided is already the best solution.
Please notice one key point:
combo box's default selected item should be one item of the combo box's Items.
If you set combo box's DefaultSelectedItem to a value that does not exist in combo box's Items, it will not display correctly.
So the solution should be that:
save the combo box's Items as a collection, add user's email address initials in this collection
set the combo box's Items and DefaultSelectedItem based on this collection.
For example:
set the app's OnStart:
ClearCollect(collection1,Custconnect.GetEmployees(envvarTenantid, envvarEnvironmentname, envvarCompanyid).value);
Collect(collection1,{fieldname:First(Split(User().Email,"@")).Result})
set the combo box's Items:
collection1
set the combo box's DefaultSelectedItems:
Filter(collection1,fieldname in User().Email)
Best regards,
User | Count |
---|---|
203 | |
92 | |
84 | |
47 | |
42 |
User | Count |
---|---|
252 | |
105 | |
103 | |
62 | |
57 |