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 / Correct way to bulk-ed...
Power Apps
Unanswered

Correct way to bulk-edit CE records

(0) ShareShare
ReportReport
Posted on by 101

I assume this is a super-common use case for PowerApps so surely there must be a solution to my problem but I just can't figure out how to do it.

 

Im working on a PowerApp which lets users bulk-edit Opportunity Lines that are assigned to an Opportunity. As a first step, I create a local collection of the required records

 

 

 

ClearCollect(
 colOppLines,
 Filter(
 'Opportunity Lines',
 Opportunity.Opportunity = varOpportunity.Opportunity
 )
);

 

 

 

This creates a local collection of 500-1,000 records from the Opportunity Lines table. Then as a second step, I have users modify 4-5 fields on the collection using a gallery.  As a final step, I am patching the CE table using the updated collection.

 

There are three methods I looked at on how to do this:

 

Method 1

 

 

 

Patch('Opportunity Lines', colOppLines)

 

 

 

This method doesnt work because it will attempt to patch all fields on the CE table. Since CE tables always have several fields that can't be modified, it results in the error "Network error when using Patch function: The specified column is read-only and can't be modified".

 

Method 2

 

 

 

ForAll(
	colOppLines,
	Patch(
		'Opportunity Lines',
		ThisRecord,
 {
 'Service Account': ThisRecord.comboboxSite.Selected, 
 'Equipment Type': ThisRecord.dropdownEqType.Selected,
 'Equipment Size': ThisRecord.dropdownEqSize.Selected,
 'Equipment Owner': ThisRecord.dropdownEqOwner.Selected
 }
 )
)

 

 

 

This method works, but takes an excessive amount of time and potentially crashes the PowerApp because it will execute the Patch function once for each record in the collection (which can contain up to 1,000 records).

 

Method 3: triggering a Power Automate flow but this similarly will take quite some time since I believe you would still have to update each record individually? Probably will be more efficient than method 2 though.

 

I'm hoping anyone else here has found a way to bulk-edit CE records in PowerApps? I'm aware of out-of-the-box ways to do it in CE but there's several other reasons why we specifically want to utilize PowerApps.

Categories:
I have the same question (0)
  • QuentinDURIEZ Profile Picture
    547 Moderator on at

    Hi,

     

    You can try by using this formula : 

     

    Patch(
    	'Opportunity Lines',
    	ForAll(colOppLines, 
    		Patch(
    			ThisRecord,
    			{
    				'Service Account': ThisRecord.comboboxSite.Selected, 
    				'Equipment Type': ThisRecord.dropdownEqType.Selected,
    				'Equipment Size': ThisRecord.dropdownEqSize.Selected,
    				'Equipment Owner': ThisRecord.dropdownEqOwner.Selected
    			}		
    		)
    	)
    )

     

    This will do a bulk patch edit to the Opportunity Lines datasource based on record in colOppLines

    Regards,

     

  • alex93jansen Profile Picture
    101 on at

    So when I try this, it still results in the error: "Network error when using Patch function: The specified column is read-only and can't be modified".

     

    presumably because of CE fields like createdon, createdby, the unique identifier etc. which it's automatically including in the outer Patch function to update the CE data source.

     

    The code below does work so these 4 fields definitely can be modified/aren't read-only:

    (but this code takes ages to execute for a large number of records)

    ForAll(
    	colOppLines,
    	Patch(
    		'Opportunity Lines',
    		ThisRecord,
     {
     'Service Account': ThisRecord.comboboxSite.Selected, 
     'Equipment Type': ThisRecord.dropdownEqType.Selected,
     'Equipment Size': ThisRecord.dropdownEqSize.Selected,
     'Equipment Owner': ThisRecord.dropdownEqOwner.Selected
     }
     )
    )

     

  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    Hello,

    I haven't tested that in environment and not sure if it'll work so it's up to you to check:

     

    ClearCollect(
    	colOppLines,
    	Filter(
    		'Opportunity Lines',
    		Opportunity.Opportunity = varOpportunity.Opportunity
    	)
    );
    
    ClearCollect(
    	colOppLinesUpdate,
    	ForAll(
    		colOppLines As ol,
    		'Opportunity Lines'@{
    			opportunityproductid: ol.'Opportunity Line',
    			/*'Service Account': ThisRecord.comboboxSite.Selected,
    			'Equipment Type': ThisRecord.dropdownEqType.Selected,
    			'Equipment Size': ThisRecord.dropdownEqSize.Selected,
    			'Equipment Owner': ThisRecord.dropdownEqOwner.Selected*/
    			//I believe you will have to use schema fields here
    			your_serviceaccountid: ThisRecord.comboboxSite.Selected
    		}
    	)
    );
    
    Patch(
    	'Opportunity Lines',
    	ShowColumns(
    		colOppLines,
    		'Opportunity Line'
    	),
    	colOppLinesUpdate
    );

    I borrowed the idea here - https://www.matthewdevaney.com/7-ways-to-use-the-patch-function-in-power-apps-cheat-sheet/ 

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard