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

Filling DefaultSelectedItems correctly on a Sharepoint list's people column

I'm currently building a meeting planning app using office 365, outlook and sharepoint.

I used the meeting template screen and tweaked it to my needs to book the meeting. At the end the app is meant to create a new row in a sharepoint list using a form. Everything is being submited correctly but the participant list that is meant to be stored in a people column that should include multiple people.

I tried using the following code in the DefaultSelectedItems:

LookUp('PoC-MeetingSession'.Participants, DisplayName in MyPeople.DisplayName)

but it didnt autofill. When I just placed MyPeople which is a collection of users straight from Office365Users.SearchUser it showed the people I had selected but during the form submition it wouldn't fill the column at all...

1 ACCEPTED SOLUTION

Accepted Solutions
MangoMan09
Level: Powered On

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@yashag2255 I decided to try solving this issue via flow and it worked!

I decided to submit the form normaly and patch the participants after via flow. The only extra step I did in the app was concatenating a list of the participants emails so i could look them up.

Here's the flow for those that might have the same issue:
1.PNG2.PNG3.PNG4.PNG

7 REPLIES 7
Super User
Super User

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

HI @MangoMan09 

 

Can you try to update the defaultselecteditems as:
Filter('PoC-MeetingSession'.Participants, DisplayName in MyPeople.DisplayName)
 
Filter gets a list of values satisfying the conditio while lookup fetches only the first record.
 
Also, can you please confirm the update property of your DataCard in this edit form, it should point to the control that you are configuring.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
MangoMan09
Level: Powered On

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@yashag2255 , thanks for the input.

 

You're right on the filter/lookup situation, that was me just copy pasting from another lookup field in hopes that it would work.

I did change it to what you suggested but the results came in blank. I even created a new data card and started again but it didn't change anything.

Capture.PNG

Could something not be set-up properly on the sharepoint end?

Super User
Super User

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@MangoMan09 

 

Can you try to do a simple test, maybe on a test screen, create a button and use the expression:
ClearCollect(TempColl,Filter('PoC-MeetingSession'.Participants, DisplayName in MyPeople.DisplayName)) and check if this is returning data. If this is returning correct data, can you please check that the combobox items and this returned table in TempColl has same attributes?  
MangoMan09
Level: Powered On

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@yashag2255  found some issues with that collection. It came out empty after running the code and with a stange name on the column.

 

Capture.PNG

Super User
Super User

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@MangoMan09 

 

Your default items are not getting populated because this filter is not returning any results. Please share more details about the logical implementation for this formula, so that we get the proper expression which returns correct records.
MangoMan09
Level: Powered On

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@yashag2255 , ok here's the rundown.

I modified the standard meeting screen to look like this:

Capture.PNG

We can search for users by DisplayName using this:

If(
    !IsBlank(Trim(TextSearchBox1_1.Text)),
    Office365Users.SearchUser(
        {
            searchTerm: Trim(TextSearchBox1_1.Text),
            top: 15
        }
    )
)

Clicking on the item will use the default code and create a collection called MyPeople with all of their Offfice365 details.

Concurrent(
Reset(TextSearchBox1_1),
Set(_selectedUser, ThisItem),
If(Not(ThisItem.UserPrincipalName in MyPeople.UserPrincipalName), 
	Collect(MyPeople, ThisItem); 
	Concurrent(
	Set(_showMeetingTimes, false),
	UpdateContext({_loadMeetingTimes: true}),
	Set(_selectedMeetingTime, Blank()),
	Set(_selectedRoom, Blank()),
	Set(_roomListSelected, false),
/*
Uses Office365 Outlook FindMeetingTimes operation to find available meeting times given various parameters including a semicolon separated list of attendee email addresses,
a meeting duration (in minutes), an acceptable start and end range to find the meeting.
Attendee emails are retrieved from the MyPeople collection. Duration and Start/End are retrieved from their respective dropdowns, where Start is set to 8:00 AM on the date selected, and End is set to 5:00 PM on the date selected.
*/
	ClearCollect(MeetingTimes, AddColumns(Office365.FindMeetingTimes(
		{RequiredAttendees:Concat(MyPeople, UserPrincipalName & ";"), MeetingDuration:MeetingDurationSelect1_1.Selected.Minutes,
		Start:Text(DateAdd(MeetingDateSelect1_1.SelectedDate, 8, Hours), UTC), End:Text(DateAdd(MeetingDateSelect1_1.SelectedDate, 17, Hours), UTC),
		MaxCandidates:15, MinimumAttendeePercentage:1, IsOrganizerOptional: false, ActivityDomain: "Work"}).MeetingTimeSuggestions,
	"StartTime", MeetingTimeSlot.Start.DateTime, "EndTime", MeetingTimeSlot.End.DateTime))
	);
UpdateContext({_loadingMeetingTimes: false});
Set(_showMeetingTimes, true)
))


My only thought about this is that the office 365 item might not match the lookup column from sharepoint when im trying to do the comparison.

MangoMan09
Level: Powered On

Re: Filling DefaultSelectedItems correctly on a Sharepoint list's people column

@yashag2255 I decided to try solving this issue via flow and it worked!

I decided to submit the form normaly and patch the participants after via flow. The only extra step I did in the app was concatenating a list of the participants emails so i could look them up.

Here's the flow for those that might have the same issue:
1.PNG2.PNG3.PNG4.PNG

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 226 members 4,139 guests
Please welcome our newest community members: