cancel
Showing results for 
Search instead for 
Did you mean: 
rampprakash

Hide Command Bar using JavaScript in Model Driven App

Implementation Steps:

 

When ever you tried to create a new Record, you will be redirected to a page like below

 

rampprakash_0-1648728054363.png

 

Red Color Highlighted Called Command Bar

 

If we want to hide that Command Bar follow below steps to achieve the same.

 

1. Navigate to https://make.powerapps.com

2. Click Solutions --> Create a new Solution

3. Click New --> Click More --> Select Web Resource and add a new Web Resource

 

rampprakash_1-1648728360258.png

4. Write below code in Web Resource

 

 

 

 

function onLoadHideCommandBar(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.ui.headerSection.setCommandBarVisible(booleanValue);
}

 

 

 

 

booleanValue : pass true or false as an option

 

true - visible Command bar

false - hide Command bar

 

Once Code Published:

 

Load or Open a new Record

 

rampprakash_0-1648836606039.png

 

Now you cannot see the Navigation Bar.

 

That's it 🙂

 

 

Comments

Can we hide specific command button inside command bar using java script in view mode and not in form mode ?

Hi @Arpit1991 ,

 

Yes, you can write a custom JS to get the Form type and Achieve it

Would this work for a subgrid's command bar that is on a form? What would the JS change look like?

No it won't work for SubGrid

😓Well, if you ever see a way to hide command buttons with JS or the whole command bar for a subgrid on the form, we would be greatly appreciative 😁

(the reason we can't accomplish this with ribbon workbench is that its for the Notes(annotation) entity which does not allow edits)