Add custom actions to the command bar in model driven apps & Dynamics 365

17th April 2023

In this blog post, we’ll take a look at how you can get a little more custom with the command bar in model driven apps and Dynamics 365 CE by including your own custom actions configurable with Power Apps!

Editing the command bar

First we need to get to the part where we can edit our command bar. So, for the model driven app or Dynamics 365 app you want to make a change to a command bar in, we’ll need to find it in Power Apps and open it in the edit mode.

Once you’re in the edit mode of your app, find the table you want to make a change to the command bar for, select the three dots next to it and then select edit command bar.

Now we’ll get the option to edit the command bar for the view of our choosing. Select the one you want to make a change to and click edit.

Now if you haven’t done this before we might need to create a component library to be able to use Power Fx formulas. Select the linked purple text in the Power Fx bar to do this.

Now let’s add a new command to the command bar… I’m going to select new and then command to add one. We can also add dropdowns and split buttons to group commands.

Now to configure my command I’m going to use Power Fx. You can also use JavaScript libraries. To pick between these two types of actions you can make the change in the Action dropdown in the right hand properties pane.

I’m going to stick with Run formula, and I’ll write some Power Fx.

I want to be able to click my button to move the onboarding stage of my account (a custom column I have) to the next stage in my preferred order. Let’s write some Power Fx…

This is the Power Fx I’m going to use…

    Self.Selected.Item.'Onboarding Status',
    Status.'Not Started',
        {'Onboarding Status': Status.'In Progress'}
    Status.'In Progress',
        {'Onboarding Status': Status.Complete}
        "This account has already completed its onboarding. You cannot move this to a further stage.",

Now I’m going to change the label on my command button and add a right arrow icon…

From here I’ll save and publish my command bar. Then I’ll click play. This will open my model driven app or Dynamics 365 app for me to test my changes. Let’s check it out!

Testing it out

Now here I have an account with an onboarding status of Not Started. Let’s now go and select the move to next stage button when I select my account and we’ll see what happens.

And there you go! There’s the updated status after clicking my custom command.

Posted in UncategorizedTags:

Leave a Reply

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

This will close in 0 seconds