Problem statement
- To modify multiple records at once in grid view using a button created in Customized Toolbar
- We make use of Power Fx to Patch the command for the button.
High level resolution steps
- Use Customized toolbar options to add a button
- Add a button in Main Grid View
- Patch the command using Power Fx Code
Detailed resolution steps
Step 1 –
Go to the desired Entity’s View eclipse in app edit options to open the command bar to add a button as shown below:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-22.png)
Step 2 –
Add the button in main grid and click on edit as shown below:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-23.png)
Step 3 –
Add a command(button) using the “new” dropdown box as shown below:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-25.png)
Step 4 –
In the right pane, select the action as “Run Formula” as shown below:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-26.png)
Step 5 –
In the formula bar, Type the below code to patch the command for modifying a row in the entity on click of a button as shown below:
Patch('Bill Table',
ForAll(Self.Selected.AllItems,
{
'Bill Table':ThisRecord.'Bill Table',
'Record Status':'Record Status(Bill Table)'.'Send record'
}
)
)
Brief about the above code:
Bill table – Table name
Record Status – field name (to be modified) into ‘Send Record’
You can replace the above names with your table name and field name.
Step 6 –
Give the visibility rule as “Show on condition from formula” and type the below formula in the formula bar:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-29.png)
Click on Save and Publish
Output:
![](https://sainacloud.com/wp-content/uploads/2024/06/image-30.png)
When you select multiple records, button appears on top in the ribbon and on click of that button, a field will be modified for all the selected records.
![](https://sainacloud.com/wp-content/uploads/2024/06/sujay.jpg)
Technical Consultant – Enjoys created low code applications using Power platform, skilled at creating automate flow using Power automate and Power Virtual agents.