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

Setting default selected items of combobox with multiple items from the Office365Users connection

Hello,

 

I'm building an automated report menu for some employees at my company. The idea is that an employee would create a report and save it so that they can access it at any time. One of the things that they select is who they're going to email the report to.

 

I have a combobox that is connected to the Office365Users connection which shows the DisplayName of each user. When the user saves their report, the email information gets saved into a sharepoint list column called "ReportEmails" like so: "BobJoe@company.com;JohnDoe@company.com"

 

The user selects the saved report name from a dropdown called ddReports. 

Using this code in DefaultSelectedValues, I'm able to pull the DisplayNames of each email from the specified report (which is saved in a SP List) and set them as the default values:

RenameColumns(

Split(

Concat(

Split(

ddReports.Selected.ReportEmails,

";"),
First(Office365Users.SearchUser({searchTerm:Result})).DisplayName,

";"),

";"),

"Result", "Value")

 

The problem is that it does not select the user item with the corresponding DisplayName, it only selects the DisplayName with none of the user data attached.

 

I'm assuming I'll need to somehow specify all of the different fields of the user in order for it to select the user item, I'm just stuck on how to do this.

 

Any help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
JChouinard2016
Frequent Visitor

I found the issue. I changed this code:

DefaultSelectedItems =

RenameColumns(

Split(

Concat(

Split(

ddReports.Selected.ReportEmails,

";"),
First(Office365Users.SearchUser({searchTerm:Result})).DisplayName,

";"),

";"),

"Result", "Value")

 

To this code:

DefaultSelectedItems =

RenameColumns(

Split(

Concat(

Split(

ddReports.Selected.ReportEmails,

";"),
First(Office365Users.SearchUser({searchTerm:Result})).DisplayName,

";"),

";"),

"Result", "DisplayName")

 

I believe that the name of the renamed column wasn't matching the name of the field that I was trying to search by, so it wasn't grabbing the user's information.

View solution in original post

1 REPLY 1
JChouinard2016
Frequent Visitor

I found the issue. I changed this code:

DefaultSelectedItems =

RenameColumns(

Split(

Concat(

Split(

ddReports.Selected.ReportEmails,

";"),
First(Office365Users.SearchUser({searchTerm:Result})).DisplayName,

";"),

";"),

"Result", "Value")

 

To this code:

DefaultSelectedItems =

RenameColumns(

Split(

Concat(

Split(

ddReports.Selected.ReportEmails,

";"),
First(Office365Users.SearchUser({searchTerm:Result})).DisplayName,

";"),

";"),

"Result", "DisplayName")

 

I believe that the name of the renamed column wasn't matching the name of the field that I was trying to search by, so it wasn't grabbing the user's information.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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