cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
imadorkous
Helper II
Helper II

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
v-bofeng-msft
Community Support
Community Support

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
v-bofeng-msft
Community Support
Community Support

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

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

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (70,637)