How to Add a Button in main Gridview and Modify Column for Multiple Records using Power FX

  • 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:

Add a Button in Main Gridview

Step 2 – Add the button in main grid and click on edit as shown below:

Step 3 – Add a command(button) using the “new” dropdown box as shown below:

Step 4 – In the right pane, select the action as “Run Formula” as shown below:

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:

Click on Save and Publish

Output:

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.