I created a Model-Driven App where I customized the command bar for the main form and added a custom button.

I want the custom button to only be visible for existing Dataverse records.
Or in other words, when the user clicks New, I want the button to be hidden. 🫥
Now, I’ve done this a bunch of times, but always forget how to do it! I am going to fix that right now, and I’m betting my future self will thank me! 😀
Not quite sure how to modify the command bar? 😕 No worries! Take a look at https://learn.microsoft.com/en-us/power-apps/maker/model-driven-apps/use-command-designer.
To show the button for existing records I clicked on my custom button, in my case, Custom 1.
I then clicked Open formula bar from the properties pane on the right, under Visibility.
In the PowerFX editor, I added !IsBlank(Self.Selected.Item.'Demo 2 Item')
.
In your Model-Driven App, make sure to replace Demo 2 Item
with the Id
column of your Dataverse entity.

Note, this also can be some other business logic. doesn’t need to be tied to a Dataverse entity.
Let’s see how it looks for a new record! Custom button is hidden! ✔️

Now let’s see how it looks for an existing record! All good! Custom button is visible! 👀

Check it out for yourself at https://mattruma.com/wp-content/uploads/2025/02/Demo2Solution_1_0_0_1.zip.
Discover more from Matt Ruma
Subscribe to get the latest posts sent to your email.