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 / How to patch the item ...
Power Apps
Unanswered

How to patch the item if only there is a change in the Gallery of items

(0) ShareShare
ReportReport
Posted on by 61

Hi,

 

I am really in a strange situation  there there is a gallery of the items, I need to capture the person name who actually updated the item from from PowerApps. When I used for all it is actually updating the all the items present in the gallery by default so is there any way only to update only if there is a change in the record?

 

Thanks in Advance!

 

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    To update items only if there is a change in the record, you can use a combination of the Patch function and a condition to check for changes.

     

    Here's how you can achieve this:

     

    1. First, identify the condition that indicates whether a record has been modified or not. This could be a flag in your data source that is set to true when the record is updated.

     

    2. In your Power Apps app, use a ForAll function to loop through the gallery items.

     

    3. Inside the ForAll function, use an If statement to check if the record has been modified (based on the condition you identified earlier).

     

    4. If the record has been modified, use the Patch function to update the item.

     

    Here's an example of how you can implement this:

     

    Let's assume your data source is a SharePoint list, and it has a field called "Modified" that is set to true when a record is updated.


    ForAll(
    GalleryName.AllItems,
    If(
    ThisItem.Modified = true, // Replace 'Modified' with the actual flag indicating changes
    Patch(
    SharePointListName,
    LookUp(SharePointListName, ID = ThisItem.ID), // Find the record to update by matching the ID
    {
    Field1: ThisItem.Field1, // Update Field1 with the value from the gallery item
    Field2: ThisItem.Field2, // Update Field2 with the value from the gallery item
    // Add other fields as needed
    }
    )
    )
    )


    In this example, the ForAll function loops through all the gallery items, and the If statement checks if the "Modified" field is true for each item. If it is true, the Patch function updates the corresponding record in the SharePoint list with the values from the gallery item.

  • Sja855 Profile Picture
    61 on at

    Hello @zmansuri 

     

    Thanks for the response. I really appreciate your effort but there is a challenge in this approach.

     

    The changes needs to be done from PowerApps, Suppose I have a dropdown column I have made the change but until unless I patch the data I can't set the flag value true. But after submitting the data how again the query runs and check the Condition So in that case I have tried this approach  like on change property the of the dropdown column I have written a query to update the flag value of the particular item true but the gallery is getting refreshed automatically once the query runs and the default value of the dropdown is setting back the old value. So this is not at all feasible!

     

    I am clueless what to do on this!

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
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard