Adding Custom Buttons to the Command Bar in Model-Driven Apps
Step-by-step guide to adding a custom command bar button to a Dataverse table in a model-driven app — using the modern Command Designer, no XML editing required.
Adding a custom button to a table’s command bar (the ribbon) is one of those tasks that sounds simple but used to involve editing raw XML files and a third-party tool called Ribbon Workbench. The good news: Microsoft has replaced that workflow with the Command Designer, a point-and-click interface built directly into Power Apps.
Here’s how to add a custom button to a table in a model-driven app, end to end.
What We’re Building
In this walkthrough, we’ll add a button to the Account table’s command bar in a model-driven app. When clicked, it will:
- Check that exactly one record is selected
- Run a Power Automate flow passing the selected record’s ID
- Show a confirmation message
You can adapt this pattern to any table and any action.
Prerequisites
- A model-driven app in a solution (not the default solution)
- Maker access to the environment
- Basic familiarity with Power Automate
Step 1: Open the Command Designer
- Go to make.powerapps.com
- Open your solution
- Click Apps → select your model-driven app → click the three dots → Edit
- In the app designer, find the table you want to add the button to (e.g., Account)
- Click the table to select it, then look for Commands in the right panel
Alternatively:
- Go to make.powerapps.com → Tables
- Open the table (e.g., Account)
- Click Commands in the left panel
You’ll see the Command Designer open with existing command bar buttons.
Step 2: Create a New Command
- Click New command (or the + button)
- You’ll be prompted to choose the location: Main form, Main grid, or Associated grid
- Main form: button appears when viewing a single record
- Main grid: button appears in the list view when records are selected
- Choose based on where your button should appear
For this example, select Main grid (so users can select a record in the list and click the button).
Step 3: Configure the Button
In the command editor panel on the right:
Label: The text that appears on the button. Keep it short — “Process Account”, “Send Report”, “Archive”. Avoid generic labels like “Click Here.”
Icon: Choose from the built-in icon library. Click the icon field and browse — there are hundreds. Pick one that visually communicates what the button does. The “Send” icon (paper plane) works for notifications, the “Play” button for processing, the “Export” icon for… exporting.
Tooltip title and description: Fill these in. They appear on hover and are important for accessibility.
Step 4: Set the Action
This is where you connect the button to something useful.
Click Action and choose the type:
Run formula — runs a Power Fx expression directly. Good for simple operations like navigating to a URL or opening a dialog.
Run a flow — triggers a Power Automate instant flow and passes record context. This is the most common choice for anything meaningful.
Select Run a flow. You’ll be prompted to select an existing instant flow or create a new one.
Creating the Flow
If you need to create the flow:
- Click Create a flow
- Power Automate opens with a template: “PowerApps (V2)” trigger
- Add your logic — the trigger will receive the record ID automatically when called from the button
- To get the record ID in the flow: in the PowerApps trigger, add an input called
recordId(Text type) - In your flow actions, use
triggerBody()['recordId']to reference it
In the Command Designer, after creating the flow, map the record ID:
- Click the flow input field for
recordId - Select Record ID from the dynamic values — this automatically passes the selected record’s ID
Step 5: Set Visibility Rules
You almost always want the button to be visible only when it’s appropriate. For a grid button, that typically means “when exactly one record is selected.”
Under Visibility, click Add rule and configure:
- Selection required: Yes
- Minimum selection count: 1
- Maximum selection count: 1
This hides the button when no records are selected and disables it when multiple records are selected — which is usually what you want for flows that operate on a single record.
You can also add custom visibility rules based on column values. For example, show the button only when Status equals “Active”:
- Rule type: Field value
- Field: Status
- Condition: Equals
- Value: Active
Step 6: Save and Publish
- Click Save in the Command Designer
- Click Publish (not just save — publish makes it live)
- Go back to your app and test it
Open the model-driven app, navigate to the Account list, select a record, and look for your new button in the command bar.
Troubleshooting Common Issues
Button doesn’t appear: Check the visibility rules. If you have a “1 record selected” rule and no record is selected, the button is hidden. Select a record and check again.
Flow isn’t being triggered: Make sure the flow is enabled (not turned off) and that the connection in the flow is valid. Check the flow’s run history after clicking the button.
Button appears but is grayed out: This usually means a visibility rule is set to disabled rather than hidden, or a selection count rule is not met.
Changes don’t appear after publish: Clear your browser cache or open the app in a private window. Published changes sometimes take a moment to propagate.
Moving the Button to Another Environment
Since the command is inside your solution, it moves with it. When you export your solution and import it into test or production, the custom command bar button comes along.
The associated Power Automate flow also needs to be in the solution. Make sure to add it: Solution → Add existing → Automation → Cloud flows → select your flow.
For anything the Command Designer can’t handle — conditional button text, complex JavaScript actions, multi-level dropdowns — you’ll need Ribbon Workbench from XrmToolBox. I still keep it installed because the Command Designer doesn’t cover everything, but it handles the majority of real-world scenarios.
Related articles
Subgrids Done Right
Subgrids show related records directly on a form. Here's how to add them, choose the right relationship, filter the records, enable inline editing, and set up a New button that pre-fills the parent lookup.
Field Visibility with Business Rules
Business rules are the fastest way to control field visibility and editability on model-driven forms without writing code. Here's how to set them up and avoid the common traps.
JavaScript in Model-Driven Apps: Patterns That Actually Matter
A senior D365 developer's guide to JavaScript in model-driven apps — form events, Xrm.WebApi, field manipulation, async OnSave, debugging, and the patterns you'll actually use in production.