Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to hide + from a sub grid using JS only

(2) ShareShare
ReportReport
Posted on by 287

Hi,

I need to hide sub-grid's + button using js & not using workbench.

I tried window.parent.document.getElementbyId().style.display='none'.

It is not working .

kindly suggest for dynamics 365.

thanks

Prashant Verma

*This post is locked for comments

  • Suggested answer
    DavidG1234 Profile Picture
    35 on at
    RE: How to hide + from a sub grid using JS only

    Hi Wei, I'm trying to accomplish something very similar, (disable +new on Opportunity subgrids on Account form but allow creation of Opportunities from Contact form) thanks for posting these videos and helpful screenshots!

    FYI, for anyone else attempting to get this working, instead of an 'enable rule' the only way I could get this working was with a 'Display Rule.'

    Follow the standard ribbon workbench process of creating a solution that only contains the entity with the button you need to modify or remove.

    Open Ribbon Workbench, load the solution, right click the button(s) in the subgrid bar that you'd like to remove/modify, choose 'customize command.'

    Under Solution Elements, create a new Display Rule, with type 'FormEntityContextRule.'  Set Default to False, Invert to True, and EntityName should be the main entity form that hosts the subgrid that you want to remove the + button from.  Then add this Display Rule to all of the Commands for all of the buttons you need to remove.  This should hide those buttons from the solution entity's subgrids on the Forms of the EntityName selected in the display rule.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How to hide + from a sub grid using JS only

    Hi,

    I've tried to create a custom entities , same prefix as you. 

    It is working expected too.

    Account

    1205.enable-rule.png

    msdyn_project

    2260.project.png

    Commands

    commands.png

    command1.png

    command2.png

    command3.png

    Display Rule

    display-rule.png

    Enable Rule

    1205.enable-rule.png

    enablerulesetting.png

    What you can do?

    1. compare your environment with above setting.

    2. Make sure the record you use to test is in active status ( if you wan to see the + button).

    IF the above suggestion didn't work

    - i also don't have an idea what is going on in your environment.

    Extra

    I've found that your commands is different from mine.

    I've made another full video for your reference

    https://youtu.be/RptQcxbNFgc

  • Prashnat Verma Profile Picture
    287 on at
    RE: How to hide + from a sub grid using JS only

    Hi@Fun Wei Jie,

    Thank you so much for the time. 

    I import the backup of the solution, button shows now.

    4578.Project.PNG

    Good night.

    Thanks

    Prashant Verma

  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How to hide + from a sub grid using JS only

    Hi,

    hmm. its weird, lets try to remove the entity rule that followed by my post, published it, does the button show up?

    If yes, lets try again. 

    If in the end the button does not show up, would you mind to provide more screenshot, such as the entityname  and etc ? 

    I am going to sleep because i have to work tomorrow. I will reply you tomorrow.

  • Prashnat Verma Profile Picture
    287 on at
    RE: How to hide + from a sub grid using JS only

    Hi @Fun Wei Jie,

    yes entity name is correct . I am doing o Project Service.

    Also I remove all the customization:- Enable rule , Commands from the ribbon & published it. It still show sub grid button hidden.

    thanks

    Prashant Verma

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How to hide + from a sub grid using JS only

    Hi,

    my order is working as expected too

    5164.4621.enable-rule.PNG

    5148.19.png

    Things you can do, 

    1. Remove the custom command you created previously.

    - NewHide +

    2. Make sure the entityname is putting correctly

    3581.20.png

    From the picture you shared are you sure it is called "msdyn_project" ?

    5164.4621.enable-rule.PNG

  • Prashnat Verma Profile Picture
    287 on at
    RE: How to hide + from a sub grid using JS only

    Okay.

  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How to hide + from a sub grid using JS only

    Hi,

    let me try in my side with Order entity. Wait a second ya.

  • Prashnat Verma Profile Picture
    287 on at
    RE: How to hide + from a sub grid using JS only

    Hi @Fun Wei Jie,

    Its like i don't see the + button as well on the grid of some other entity. Also if i go through assiciated view I see Add button but it don't work.

    Attaching the screen shots . Also tried in diffrent browser as well.

    4431.Ribbon.PNG

    4431.Ribbon.PNG

    Thanks

    Prashant Verma

  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How to hide + from a sub grid using JS only

    Hi ,

    let me try on using order, wait me a second.

    at the mean time:

    1.make sure you publish after you made the changes in ribbon workbench ya.

    2.lets try in different browsers

    3.see if there any more rule on the grid.

    4. screenshot your ribbon workbench page and attach here.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans