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 a collection ...
Power Apps
Answered

Patching a collection to a Dataverse table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

App creates a collection by filtering a Dataverse table:

 

ClearCollect(ExampleCollection,Filter(ExampleDataverseTable,ExampleCoumnValue=ExampleValue))

 

The app both updates existing rows and adds new rows to the collection. The Collection is then patched back to the Dataverse table.

 

Patch(ExampleDataverseTable,ExampleCollection)

 

For adding new rows this seems to work fine. However, as soon as I edit an existing row the patch action generates a Network error.

 

NaivePowerApper_0-1685636898742.png

 

Is there a straightforward way to resolve this issue? 

 

 

 

Categories:
I have the same question (0)
  • NaivePowerApper Profile Picture
    Microsoft Employee on at

    Thanks, this was super helpful.

     

    I messed around with it a little more. It appears that it's possible to achieve the same thing without the ForAll loop by using ShowColumns.

     

    Patch(ExampleDataverseTable,ExampleCollection,ShowColumns(ExampleCollection,"ExampleCollumn1","ExampleCollumn2"))

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @NaivePowerApper ,

     

    Because the collection contains some read-only fields in ExampleDataverseTable, when you use it to update the data source, PowerApps thinks that you also need to modify these read-only fields. The solution is to cull these read-only fields.

     

    ForAll(
     ExampleCollection,
     If(
     IsBlank(
    	 LookUp(ExampleDataverseTable,Name=ExampleCollection[@Name])
    		),
    	 Patch(
    	 ExampleDataverseTable,
    	 Defaults(ExampleDataverseTable),
    	 ThisRecord
    		),
    	 Patch(
    	 ExampleDataverseTable,
    		LookUp(ExampleDataverseTable,Name=ExampleCollection[@Name]),
    		{
    		Column1:ThisRecord.Column1,
    		Column2:ThisRecord.Column2	
    		}
    	 )
    	)
    )

     

    Best Regards,

    Bof

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
Kalathiya Profile Picture

Kalathiya 403

#2
WarrenBelz Profile Picture

WarrenBelz 338 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 320 Super User 2025 Season 2

Last 30 days Overall leaderboard