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 and Update exist...
Power Apps
Answered

Patch and Update existing SharePoint List from Collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a collection that stores the following data: ProjectID, ControlID, Description.

I patch the data to the sharepoint list named "Project to Control" by the following code:

ForAll('collection' As _item,

  Patch('Project to Control',

           {ProjectID: _item.ProjectID,

           ControlD: _item.ControlID,

           Description: _item.Description}

          )

)

Assume there are some existing data in the SharePoint list, how can I update the existing SharePoint list from the collection if the record has the same ProjectID & ControlID and create a new record to the SP list for the rest?

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,940 Most Valuable Professional on at

    Hi @Anonymous ,

    Try this format

    Patch(
     'Project to Control',
     ForAll(
     'collection' As _item,
    	 With(
     {
     wID,
     Lookup(
     'Project to Control',
     ProjectID = _item.ProjectID &&
     ControlID = _item.ControlID
     ).ID
     },
     If(
     IsBlank(wID),
     { 
     ProjectID: _item.ProjectID,
     ControlD: _item.ControlID,
     Description: _item.Description
     },
     { 
     ID: _item.ID,
     ProjectID: _item.ProjectID,
     ControlD: _item.ControlID,
     Description: _item.Description
     }
     )
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • WarrenBelz Profile Picture
    155,940 Most Valuable Professional on at

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It works! Thank you so much for your help! @WarrenBelz 

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard