cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ajmicrosoft
Regular Visitor

Form multi-user separate record

I have a person field that allows multi selections in a form. What I am trying to do is have it create separate records in my sp list for each person who is chosen with the same information in the rest of the form.

For example,

Form:
User: John Doe, Jane Doe
Subject: Test
Date: 4/2/20

Then in my Sharepoint list I want it to show as:

Jane Doe 4/2/20 Test
John Doe 4/2/20 Test

How would I do this?
2 ACCEPTED SOLUTIONS

Accepted Solutions
ilton
Resolver II
Resolver II

Hi! @Ajmicrosoft 

try creating a custom form with the fields you described.

instead of using SubmitForm() use 

// I'm assuming that InputReturningListOfUsers returns a collection of Strings like ['John Doe', 'Jane Doe']
ForAll(InputReturningListOfUsers, Patch(sharepointDataSource, Defaults(sharepointDataSource), {User: Value, Subject: FormInputSubject.Text, Date: FormInputDate.Text}));

View solution in original post

@ilton my apologies for jumping in here, but I had a similar issue recently where the code I got to work may help here?

 

@Ajmicrosoft 

Try this:

ForAll( RenameColumns(DataCardValue2.SelectedItems, "DisplayName", "DisplayName1"), 
     Patch (‘List 1’, Defaults(‘List 1’), 
           {Person_x0029_s_x0030_: Filter(DataCardValue2.SelectedItems,
                 DisplayName = DisplayName1), 
            Subject: DataCardValue20.Text, 
            Date: DataCardValue21.Text
           }
     )
);

 

 

View solution in original post

6 REPLIES 6
ilton
Resolver II
Resolver II

Hi! @Ajmicrosoft 

try creating a custom form with the fields you described.

instead of using SubmitForm() use 

// I'm assuming that InputReturningListOfUsers returns a collection of Strings like ['John Doe', 'Jane Doe']
ForAll(InputReturningListOfUsers, Patch(sharepointDataSource, Defaults(sharepointDataSource), {User: Value, Subject: FormInputSubject.Text, Date: FormInputDate.Text}));

View solution in original post

@ilton

When I tried this, I got “invalid argument type” code is as follows:

ForAll (DataCardValue2, Patch (‘List 1’, Defaults(‘List 1’), {Person_x0029_s_x0030_:Value, Subject: DataCardValue20.Text, Date: DataCardValue21.Text}));

Also note the person box is a combobox with “allow multiple selection of users” on
ilton
Resolver II
Resolver II

Hi! @Ajmicrosoft 

DataCardValue2 is returning the input object you need DataCardValue2.Value to get the collection.

if you don't know the collection object type try 

ClearColect(someVariable, DataCardValue2.Value)
// and check the collections type in power apps menu.

 

@ilton my apologies for jumping in here, but I had a similar issue recently where the code I got to work may help here?

 

@Ajmicrosoft 

Try this:

ForAll( RenameColumns(DataCardValue2.SelectedItems, "DisplayName", "DisplayName1"), 
     Patch (‘List 1’, Defaults(‘List 1’), 
           {Person_x0029_s_x0030_: Filter(DataCardValue2.SelectedItems,
                 DisplayName = DisplayName1), 
            Subject: DataCardValue20.Text, 
            Date: DataCardValue21.Text
           }
     )
);

 

 

View solution in original post

@ilton

So this worked! Except it’s not putting each user in a different record it’s just duplicating the record for the number of users selected. For example:

List item 1: Jane Doe, John Doe. 4/2/20 Test
List item 2: Jane Doe, John Doe. 4/2/20 Test

Instead of doing:

List item 1: Jane Doe, 4/2/20, Test
List item 2: John Doe, 4/2/20, Test

Thanks for your help by the way!

Thank you both!!!!! This worked!!!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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 (3,910)