How to add command button and call PowerFX to change record status
In this post you will come to know below points.
- Adding new command button of the main form
- calling powerfx from button click
- changing status of record using powerfx with Patch function.
Follow step by step below to know more.
Step 1 : Add Command Button
Open the solution and navigate to Model Driven App and click Edit button.

In the editor navigate to the Sitemap page which represents the table and click Edit Command Bar.

in the next screen, choose main form command bar option to load main form command bar.

In the next screen click ass new button and update the button property label as “Update Status”.

Step 2 : Call Power FX from Button
In the Action property of button call below powerfx.
Patch('Doctor Informations',Self.Selected.Item,{Status:'Status (Doctor Informations)'.Inactive});Notify("Record Status Changed Successfully")

Testing
Now open model driven app and open a form where you have added the button. Now you can see the button and on click of button you can see the status changes to inactive.
Hope it Helps.