cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID.

My ComboBox is set to only allow one selection. 

The Items property is set to: Office365Users.SearchUser({top:999})

I save the ID from that selected record when the user saves the form, to a SQL table.

But when the user comes back to edit the form, I'd like to have the4 ComboBox default to their saved value from the Table. But I am confused at how to set the Selected (or SelectedItems) Property. Nothing I do seems to be valid. 

Any help would be terrific. Thanks!

5 REPLIES 5
Highlighted
Super User
Super User

Re: I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

Hi @dBrand ,

You have not provided the field name you are storing it in - I will use YourUserField below and assume you are using the DisplayName in the selection, so the DefaultSelectedItems would be

{DisplayName:ThisItem.YourUserField}

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper I
Helper I

Re: I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

I am storing it in field ID, but I get it. However, It doesn't appear to actually set the Combo box to that record, as I am unable to user the ComboBox.Selected to populate other fields with values from that User (such as email). Not sure if that means I'm missing something or need to do a lookup?

Highlighted
Super User
Super User

Re: I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

@dBrand ,

I did a test here and using the Items

Office365Users.SearchUser({top:999}).DisplayName

in a ComboBox, then populating a Text field (I am not sure how you are using ID as it is Numeric) with the Update of the card

ComboBoxName.Selected.DisplayName

 was able to get it to display back using what I posted.

What are you doing different?

Highlighted
Helper I
Helper I

Re: I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

In the ComboBox DefaultSelectedItems I have:  {DisplayName:ThisItem.ManagerFName&" "& ThisItem.ManagerLName}  (I wanted to use DisplayName, but that's not a choice).

 

If I select a name from the ComboBox dropdown, it properly shows me the other fields in other text boxes. But I only save the ID of that user in my database. When I call up a saved record, it shows me the first and last name in the ComboBox, but the other boxes/fields that show the other fields for that selected item (such as ComboBoxSelected.Mail) do not show anything. This leads me to believe that the record is not really selected in the ComboBox. If I reselect a name in the ComboBox, it then shows me that records details in those other fields/boxes.

 

I hope that makes sense.

Highlighted
Super User
Super User

Re: I am confused as to how to set the DefaultItems in a ComboBox to a saved user ID

HI @dBrand ,

This is a bit of an expansion on the issue and I would suspect your other fields have some sort of relationship with this combo box?

I assume you are writing back the concatenated result somewhere (what is the combo box updating and with what data)?

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,152)