web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

How to hide sub-grid buttons in a quickview form?

(0) ShareShare
ReportReport
Posted on by 905

Hello,

I doubt that is possible but I am trying to find a way to hide "Add new & Add Existing" from the quick-view form of the sub-grid.
pastedimage1679857629249v1.png

If it is not possible, can we have logic that if the user is trying to create an entry from Table X throw an exception that he cannot add an entry from this table?

I would greatly appreciate it if you could provide an example.

Best regards,

EBMRay

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hi

    It is not possible to hide "Add new & Add Existing" buttons from the quick view form of the sub-grid. However, you can disable the "Add new & Add Existing" buttons on the sub-grid itself so that users are not able to add new records to that sub-grid.

    To do this, follow the steps below:

    Open the form in the form editor and navigate to the sub-grid you want to modify.

    Click on the "Controls" tab and select the sub-grid control.

    In the "Properties" section, expand the "Behavior" section.

    Set the "Add new record" and "Add existing record" properties to "false".

    Alternatively, you can add a JavaScript function to disable these buttons based on a certain condition. For example, if you want to disable the "Add new" button when the user is trying to create an entry from Table X, you can use the following code:

    function disableAddNewButton() {

     var gridControl = Xrm.Page.getControl("yourSubGridControlName");

     var addButton = gridControl.getControl("addButton");

     addButton.setDisabled(true);

    }

    function checkForTableX() {

     var entityName = Xrm.Page.data.entity.getEntityName();

     if (entityName === "tablex") {

       disableAddNewButton();

     }

    }

    Xrm.Page.data.entity.addOnSave(checkForTableX);

    This code will disable the "Add new" button on the sub-grid when the user is trying to create a record from Table X. The addOnSave function is used to trigger the checkForTableX function whenever a record is saved on the form.

    DAniele

  • Suggested answer
    Eiken Profile Picture
    on at

    Hi,

    You can hide button using ribbon work bench.

    Open Ribbon Workbench and select related Entity and then you will get 3 levels.(You need select Employee Rates here)

    Entity

    Subgrid

    Form.

    SO in Subgrid which button, you want to hide then right click and Hide.

    pastedimage1679972463708v1.png

    Then the Add button have been hiden.

    pastedimage1679972551048v2.png

  • EBMRay Profile Picture
    905 on at

    Hello DAnny3211 ,

    I appreciate the steps provided.

    This first option will not work because it will disable add/add existing everywhere including the main entity, and I want to avoid that.

    I think the JS workaround will make it work since it will only disable the buttons on the same table.

    In the example provided, it will only disable the (Add Button). What will be the updated code to also disable the (Add Existing button)?

    Awaiting your response and will try it and get back to you.

    Best regards,

    EBMRay

  • EBMRay Profile Picture
    905 on at

    Hello Eiken ,

    Unfortunately, the sub-grid is in a quick view and that option won't work.

    As an alternative a JS would be needed to hide those two buttons on the sub-grid.

  • Suggested answer
    Eiken Profile Picture
    on at

    Hi,

    It still works in sub-grid in a quick view.

    You need only remove the button on the selected entity, then all quick view which use this entity's sub-grid will hide the button.

    pastedimage1679989849708v1.png

    Now

    pastedimage1679989870443v2.png

  • EBMRay Profile Picture
    905 on at

    Hello Eiken ,

    The disadvantage is that it will hide both buttons from the entity itself (everywhere) and I don't want that. The main goal is only to hide it from a quick view form and from a specific entity.

    If this is not possible in RibbonWorkBench, can you show the alternative way of disabling the button from a sub-grid onLoad of the form?

    Awaiting your response.

    Best regards,

    EBMRay

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 80

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans