How to update multiple records in a model-driven app grid using Power Fx commanding

How to update multiple records in a model-driven app grid using Power Fx commanding

If you wanted to add a button to a command bar to perform an update on multiple records in a grid, you can easily create a formula that results in slow performance caused by multiple grid refreshes. This post outlines, the most performant way of applying updates to multiple records from a Power Fx command button.

Step 1 - Add your button

Inside the modern command bar editor, add a button to the Main Grid or Sub Grid command bars of the Account entity.

Step 2 - Set the Visibility rule

Any buttons on a grid that apply to selected records will only become visible if you provide a visibility rule.

Select the Visibility property, and select Show on condition from formula.

In the formula bar at the top, enter the following:


Step 3 - Add the command formula

Select the Action of the button, and select Run formula.

In the formula bar at the top, enter the following:

// Paralle Updates
            'Credit Hold':'Credit Hold (Accounts)'.Yes 

Note: If you are adding a button for a different entity, you will need to change the table name (Accounts) and primary key column name (Account).

Step 4 - Save and Publish, then Play your app!

The changes will take a short while to appear in your app. You will see a message similar to the following when the changes are ready:

Parallel vs Sequential Patches

If you used the following formula, it would result in multiple grid refreshes since the Patches will be done in sequence.

// Sequential Updates
        { 'Credit Hold':'Credit Hold (Accounts)'.No }

Using the parallel version above instead of this sequential one will try and perform as many parallel updates as the browser can handle. This is due to the limited number of HTTP requests that can be sent simultaneously from the browser.
You can see in the timeline below, that only 6 parallel requests are in progress at once.

Despite this, this technique will be considerably more efficient than performing the updates sequentially, and the grid will only be refreshed the once, instead of with each record updated.


Published on:

Learn more
Develop 1 - Dynamics 365 Architecture Services
Develop 1 - Dynamics 365 Architecture Services

Share post:

Related posts

Web resource method does not exist in Dynamics 365 CE

Got the below error while working on Onload of Account record JavaScript in Microsoft Dynamics 365 CE. Script Error One of the scripts for thi...

1 day ago

How to get Environment Variable Value in Dynamics 365 CE using JavaScript?

We might have got a scenario to use the Environment Variable Value in the JavaScript in Dynamics 365 CE. In this article, will explain about r...

2 days ago

Enhancing Business Efficiency with Dynamics 365 CE/CRM AI Capabilities

Artificial intelligence (AI) is a vital catalyst for business transformations in this digital era. A leading player in this revolution

4 days ago

Power FX in Power Pages

The Microsoft team keeps adding new features and functionality to Power Pages. Just announced, the ability to use Power FX in Power Pages! See...

1 month ago

Using Power Fx on Power Apps command bar

If you're looking to enhance the functionality of your model-driven Power Apps, one way to do so is by adding custom commands to the command b...

1 month ago

Interview Questions and Answers Dynamics 365 CE and Power Platform – Ultimate Guide

In today's business landscape, Dynamics 365 Customer Engagement (CE) and the Power Platform have emerged as game-changing tools that have tran...

1 month ago

Back to Basics # 72: Limit Special Characters Using a Webresource in Dynamics CRM

Recently we got a requirement to restrict user to enter special characters. Step 1 : Use the below method for restricting special characters S...

1 month ago

Most used PowerFX in Canvas APP List

If you're working with Power Apps to create Canvas apps, then understanding the most important Power Fx list functions is critical for managin...

2 months ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy