web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch entire Gallery t...
Power Apps
Suggested Answer

Patch entire Gallery to SharePoint List

(1) ShareShare
ReportReport
Posted on by 531
I have a Gallery where i can add max 3 rows by click of add button. I need to create all the below 3 rows to my SharePoint list on click of main submit button in the Newform. I tried below code but it doesnt work. May i know where i am wrong?
 
 
Add button OnSelect
Collect(
    yourCollection,
    {
        Name: "",
        Email: "",
        Designation: "",
        Contact: "",
        RandID: Rand(),
        ID: Last(
            Sort(
                'DS',
                ID,
                SortOrder.Ascending
            )
        ).ID + 1
    }
);
 
Gallery Items Property
yourCollection
Submit Button OnSelect to save it to SharePoint list
 
ForAll(
    Gallery1.AllItems As ITEM1,
    Patch(
        'DS Details',
        Defaults('DS Details'),
        {
            Title: TextInput1.Text,
            'SO Email': TextInput2.Text,
            'SO Designation': TextInput3.Text,
            'SO Phone': TextInput4.Text
        }
    )
);
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,739 Most Valuable Professional on at
    You are close, but instead of referencing the controls in the template of the gallery you should be referencing the field names of the columns in the collection using thisRecord. ThisRecord is used to identify the time that the ForAll is working on at that point so you can reference the fields. Something like this:
     
    ForAll(
        Gallery1.AllItems,
        Patch(
            'DS Details',
            Defaults('DS Details'),
            {
                Title: thisRecord.Title,
                'SO Email': thisRecord.Email,
                'SO Designation': thisRecord.Designation,
                'SO Phone': thisRecord.Phone
            }
        )
    );

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
     
  • vipuljain03 Profile Picture
    665 Super User 2025 Season 2 on at
    The issue in your code is mainly in ForAll function. Instead of referencing the controls value directly, these needs to be referenced using This.Record, as mentioned by @Pstork1.
     
    You can refer this video for more detailed explanation - https://www.youtube.com/watch?v=lJaMRnTsZlE

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard