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

Announcements

News and Announcements icon
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 603
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
    69,653 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
    703 Super User 2026 Season 1 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard