Demo 11 - Command button

Objective: In this demo, you will show how to add a command button to a model-driven app that will reject and cancel a pet trick when in evaluation status.

Task 11.1 - Add command button

  1. Edit the model-driven app.
  2. Edit the command bar for the Pet Tricks view.
  3. Select Main form.
  4. Add a new command.
  5. Select Power Fx.
  6. Enter Reject Trick for Label.
  7. Select Reply for Icon.
  8. Set Action to Run formula.
  9. Open formula bar and enter Patch('Pet Tricks', Self.Selected.Item, {'Status Reason': 'Status Reason (Pet Tricks)'.Rejected}).
  10. Set Visibility to Show on condition from formula.
  11. Open formula bar and enter If(Self.Selected.Item.'Status Reason' = 'Status Reason (Pet Tricks)'.Evaluation, true, false).