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 / Patching existing item...
Power Apps
Answered

Patching existing items from gallery to SP

(0) ShareShare
ReportReport
Posted on by

Hi!

I have a gallery acting as an editable Grid, I'm trying to modify items and then patching. But my problem is the patching only works, for when I edit an item at a time when I edit two, 3 or more items it only saves one value(the last that the input takes).

 

I only need to edit one field which is the text input of each rows of each item.

This is the original code I was using :

ForAll(
    colGridProyectosUpdates;
    Patch(
        'Propuesta Carga de Hs';
        ThisRecord;
        {
            Horas: Value(HorasProyectos_txtInput.Value);
            ItemModificado_Comment: CommentariosModificados_txtInput.Value;
            'Estado Modificación': {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
                Value: "Pendiente"
            }
        }
    )
)
 
When I started noticing that it only saved one value when I changed more than one item, I changed the code to the following to try to specify the different items IDs:
 
ForAll(
    colGridProyectosUpdates As Proyectos;
    Patch(
        'Propuesta Carga de Hs ';
        LookUp('Propuesta Carga de Hs '; ID = Proyectos.ID);
        {
            Horas: Value(HorasProyectos_txtInput.Value);
            ItemModificado_Comment: CommentariosModificados_txtInput.Value;
            'Estado Modificación': {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
                Value: "Pendiente"
            }
        }
    )
)

But it still does the same.. any idea on how I make it work and save the corresponding value to the item "Horas" to the corresponding item in sharepoint?

 

Thank you!

Categories:
I have the same question (0)
  • Verified answer
    SpongYe Profile Picture
    5,616 Super User 2025 Season 2 on at

    Hi @MarTorres07 

     

    The problem is the fields input that you use in the Patch:

    txtInput.Value will always take the first value out of the Gallery. 

     

    This needs to be stored in colGridProyectosUpdates to be able to store the correct value.

     

    You code would look like:

    ForAll(
     colGridProyectosUpdates As Proyectos;
     Patch(
     'Propuesta Carga de Hs ';
     LookUp('Propuesta Carga de Hs '; ID = Proyectos.ID);
     {
     Horas: Proyectos.Horas; // << here
     ItemModificado_Comment: Proyectos.ItemModificado_Comment; // << and here
     'Estado Modificación': {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
     Value: "Pendiente"
     }
     }
     )
    )

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • MarTorres07 Profile Picture
    on at

    Thank you so much! that was it, I had no idea I could use it like that and I didn't find any examples anywhere. Now I will have it it mind more often since I learned something new 🙂

  • SpongYe Profile Picture
    5,616 Super User 2025 Season 2 on at

    Hi @MarTorres07 

     

    Nice to hear. Good to hear!

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

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 739 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 268

Last 30 days Overall leaderboard