cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Nested Collection? & Saving it back to SharePoint

I have a simple SharePoint list, where there are two columns:

1. Team Name (Column name is actually called Title in SP) and the type is a Single Line of Text

2. Team Members (Column name is actually called Partners in SP) and the type is Person or Group, with multiple selections

 

In my app, I created a Search interface to search for users from Office365Users database, and I save it into a gallery called MyPeople. So its collecting a lot of columns

2020-05-07 11_12_53-CIP RAIL - Saved (Unpublished) - Power Apps.png2020-05-07 11_09_16-CIP RAIL - Saved (Unpublished) - Power Apps.png

 

What I wanted to do was save the collection of display names with the team names and save it back to SharePoint. So I what I did was create another collection called CFTeamCollection that only took the display names of the users added and save it with the team name. But that doesnt seem to work. What am I doing wrong?

 

 

2020-05-07 11_07_18-CIP RAIL - Saved (Unpublished) - Power Apps.png2020-05-07 11_19_26-CIP RAIL - Saved (Unpublished) - Power Apps.png

 

2020-05-07 11_19_37-CIP RAIL - Saved (Unpublished) - Power Apps.png

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Nested Collection? & Saving it back to SharePoint

https://powerusers.microsoft.com/t5/Building-Power-Apps/Nested-Collection-amp-Saving-it-back-to-Shar...

Hi @imadorkous :

Do you want to use the records in CFTeamCollection to update your SharePoint list?

Firstly, let me explain why you cant update the record.

The key is that you should use a specific format to update the "person" field(allow multiple selections)

 

Table({
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Department: "",
            Claims: "i:0#.f|membership|" & specific mail,
            DisplayName: specific displayName,
            Email: specific mail,
            JobTitle: "",
            Picture: ""
        })

 

Secondly, Ive made a test for your reference:

My data source:

Column (click to edit)

Type

Title

Single line of text

Partners

Person or Group(allow multiple selections)

1\I suggest you use this code to create your XX collection:

 

ClearCollect(
    CFTeamCollection,
    {
        Title: "Rockstars",   /* You can set it to the value of your TextInput control*/
        Partners: AddColumns(
            RenameColumns(
                ShowColumns(     /* Only some fields in MyPerple are needed*/
                    MyPeople,
                    "DisplayName",
                    "Mail",
                    "Department",
                    "JobTitle"
                ),
                "Mail",     /*"Mail" does not meet the specifications, rename it to "Email"*/
                "Email"
            ),
            "@odata.type",
            "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            "Claims",
            "i:0#.f|membership|"&Email,
            "Picture",
            ""                     /*Finally get a table that meets the specifications*/
        )
    }
)

 

2\Add a button and set its OnSelect property to:

 

Patch('List A',Defaults('List A'),{Title:First(CFTeamCollection).Title,Partners:First(CFTeamCollection).Partners})
/* Because I use ClearCollect to create CFTeamCollection, it will always have only one record. Here I default to update the SharePoint List with the value of the first record of CFTeamCollection. */

 

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Nested Collection? & Saving it back to SharePoint

https://powerusers.microsoft.com/t5/Building-Power-Apps/Nested-Collection-amp-Saving-it-back-to-Shar...

Hi @imadorkous :

Do you want to use the records in CFTeamCollection to update your SharePoint list?

Firstly, let me explain why you cant update the record.

The key is that you should use a specific format to update the "person" field(allow multiple selections)

 

Table({
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Department: "",
            Claims: "i:0#.f|membership|" & specific mail,
            DisplayName: specific displayName,
            Email: specific mail,
            JobTitle: "",
            Picture: ""
        })

 

Secondly, Ive made a test for your reference:

My data source:

Column (click to edit)

Type

Title

Single line of text

Partners

Person or Group(allow multiple selections)

1\I suggest you use this code to create your XX collection:

 

ClearCollect(
    CFTeamCollection,
    {
        Title: "Rockstars",   /* You can set it to the value of your TextInput control*/
        Partners: AddColumns(
            RenameColumns(
                ShowColumns(     /* Only some fields in MyPerple are needed*/
                    MyPeople,
                    "DisplayName",
                    "Mail",
                    "Department",
                    "JobTitle"
                ),
                "Mail",     /*"Mail" does not meet the specifications, rename it to "Email"*/
                "Email"
            ),
            "@odata.type",
            "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            "Claims",
            "i:0#.f|membership|"&Email,
            "Picture",
            ""                     /*Finally get a table that meets the specifications*/
        )
    }
)

 

2\Add a button and set its OnSelect property to:

 

Patch('List A',Defaults('List A'),{Title:First(CFTeamCollection).Title,Partners:First(CFTeamCollection).Partners})
/* Because I use ClearCollect to create CFTeamCollection, it will always have only one record. Here I default to update the SharePoint List with the value of the first record of CFTeamCollection. */

 

 

Best Regards,

Bof

View solution in original post

Highlighted
Helper I
Helper I

Re: Nested Collection? & Saving it back to SharePoint

@v-bofeng-msft  - YOU ARE A MASTER! WORKED LIKE A CHARM!!!

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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