cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StuPower
Level: Powered On

Populating previously selected options in a combo box

Hello

 

We're storing selected options from the combo box into a SharePoint list. When the user goes back in to their form we need those options to show within the combo box. Is that possible yet?

4 REPLIES 4
Super User
Super User

Re: Populating previously selected options in a combo box

@StuPower 

Yes, this is all possible with the DefaultSelectedItems property of the ComboBox.  

However, if you are using this in an EditForm, then the datacard will provide this functionality for you without having to change anything.

If you are using the ComboBox outside of an edit form, then you will need to supply the logic to the DefaultSelectedItems property of the control.

 

If you still have questions, please provide some more specific examples, screenshots or formulas that might be helpful in deducing your problem.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
StuPower
Level: Powered On

Re: Populating previously selected options in a combo box

@RandyHayes 

 

Thanks

 

So ive had a play and i can see ComboBoxes arent as easy as normal field with regards to patching

 

i.e this won't work -

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

Ive found posts which use something like this

{'Links to strategy':ForAll(ComboBox.SelectedItems,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:Value})}

But this code dosen't work either.

 

So to over come this ive used concat and placed the values into a label and then patched the labels value into SharePoint. This part is fine for what i need.

 

But i now can't prepopulate those values back into the combobox using "defaultselecteditems" when i select my record from a gallery as from my understanding its needs a Value and a ID?

DefaultSelectedItems: ObjectiveRecord.'Links to strategy'

 

Any help is greatly appreciated as documentation on this field seems very scarce

 

Super User
Super User

Re: Populating previously selected options in a combo box

@StuPower 

Actually, you might be overcomplicating things for yourself a bit.  

The first formula actually does work and works fine.

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

So, if that is not working for you, then I'd suggest getting to the root cause of that problem rather than create another method to work around it.  That will just bring you more grief. 

 

If the above is not working, then there are at least two things to look at first:

1) The definition of your column.  This is most important.  Are we looking at a Choice column (I assume) and what kind of parameters are set for it?  Does it allow multi-select?  Does it allow add-in choices?  (Are you trying to add in choices? ) Does it have any other conditions to it?

2) The Items of your ComboBox - they should be a table of Value records...that is all you need for the above to work. Best choice is the Choices function as it was designed to give you the viable choices for a column  If you are doing anything different (such as Distinct or filter or other) you will need to pre-shape the items data into a table of Value records.

 

Based on those two observations, you should be able to get to the root cause of why your patch statement doesn't work.

BUT...the point being - that patch statement should work fine if the proper conditions are set up for it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
TopShelf-MSFT
Level 10

Re: Populating previously selected options in a combo box

Hi @StuPower can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,214)