cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jgellel
Frequent Visitor

ComboBox - Default Selected Items

Hello Everyone,

 

I'm having a problem in having the text showing in the combobox. 

 

DefaultSelectedItems = If(!IsBlank(varTimesheetRecord), Office365Users.SearchUser({searchTerm:varTimesheetRecord.Approver.DisplayName}),Office365Groups.ListGroupMembers("<Group ID>").value)

 

When i click on the DisplayName on the above code i can actually see/read the name i need - it just doesn't show in the combobox.

 

Any help would be greatly appreciated.

 

Thanks | J

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @jgellel ,

 

Is the problem you encountered is that Default Selected Items doesn't show in the Combo Box?

Could you please provide your items property of your Combo Box Control?

 

I have made a test for your reference.

 

1. Add a Combo Box Control and apply the following formula on its Items property as:

Office365Users.SearchUser()

2. Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

Office365Users.SearchUser({searchTerm:DisplayName})

vyujincuimsft_0-1641982647477.png

vyujincuimsft_1-1641982647481.png

3. Add a new Combo Box and apply the following formula on its Items property as:

Office365Groups.ListGroupMembers("GroupID").value

4. Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

Office365Groups.ListGroupMembers("47369275-8f08-4db3-9e39-23cf0c4d887e").value

vyujincuimsft_2-1641982647483.png

vyujincuimsft_3-1641982647485.png

5. You can observe that the table structure returned by the Items of the two Combo Boxes is different, maybe this is the reason for the problem.

https://docs.microsoft.com/en-us/connectors/office365groups/#listgroupmembers_response

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users#...

So if you use Office365Users.SearchUser() and Office365Groups.ListGroupMembers().value directly in the same If statement , one of the functions will not work.

6.Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

If(!IsBlank(varTimesheetRecord),Office365Users.SearchUser({searchTerm:varTimesheetRecord}),Filter(Office365Users.SearchUser(),"yes" in ForAll(Office365Groups.ListGroupMembers("GroupID").value,If(displayName = DisplayName,"yes","no"))))

vyujincuimsft_4-1641982647490.png

Result Screenshots:

vyujincuimsft_5-1641982647494.png

vyujincuimsft_6-1641982647495.png

 

Best Regards,

Charlie Choi

View solution in original post

3 REPLIES 3
BrianS
Super User
Super User

I may be wrong - I can't test this now, but I believe Combo boxes want Records, not fields, so you may be going too far down the tree. 

jgellel
Frequent Visitor

Hi Brian,

 

So what i'm after is that if var<> record is not blank, the name of the approver (saved in SP List) is to be loaded if not the secretary (listed in Office365Group) is to show as the defaultselecteditems of the combobox.

 

Thanks | J

v-yujincui-msft
Community Support
Community Support

Hi @jgellel ,

 

Is the problem you encountered is that Default Selected Items doesn't show in the Combo Box?

Could you please provide your items property of your Combo Box Control?

 

I have made a test for your reference.

 

1. Add a Combo Box Control and apply the following formula on its Items property as:

Office365Users.SearchUser()

2. Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

Office365Users.SearchUser({searchTerm:DisplayName})

vyujincuimsft_0-1641982647477.png

vyujincuimsft_1-1641982647481.png

3. Add a new Combo Box and apply the following formula on its Items property as:

Office365Groups.ListGroupMembers("GroupID").value

4. Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

Office365Groups.ListGroupMembers("47369275-8f08-4db3-9e39-23cf0c4d887e").value

vyujincuimsft_2-1641982647483.png

vyujincuimsft_3-1641982647485.png

5. You can observe that the table structure returned by the Items of the two Combo Boxes is different, maybe this is the reason for the problem.

https://docs.microsoft.com/en-us/connectors/office365groups/#listgroupmembers_response

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users#...

So if you use Office365Users.SearchUser() and Office365Groups.ListGroupMembers().value directly in the same If statement , one of the functions will not work.

6.Select the Combo Box and apply the following formula on its DefaultSelectedItems property as:

If(!IsBlank(varTimesheetRecord),Office365Users.SearchUser({searchTerm:varTimesheetRecord}),Filter(Office365Users.SearchUser(),"yes" in ForAll(Office365Groups.ListGroupMembers("GroupID").value,If(displayName = DisplayName,"yes","no"))))

vyujincuimsft_4-1641982647490.png

Result Screenshots:

vyujincuimsft_5-1641982647494.png

vyujincuimsft_6-1641982647495.png

 

Best Regards,

Charlie Choi

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,476)