Wednesday, 25 November 2015

Hide ‘Add Existing Button’ or Plus (+) Button In CRM 2013 Subgrid

Brief Introduction

This requirement often comes and the only supported way is to either hide through Security Role (which in most cases this is not possible and using Ribbon Workbench to hide it), but sometimes you need to only hide in some forms and you need to hide all necessary ribbons using Ribbon Workbench (FYI, one of my favorite tool)
So here is the code to hide the + button for Subgrid:

The Code

function hideAddButtonSubgrid(subgridId) {
    try {
        addEventToGridRefresh(subgridId, setAddButtonDisplayNone);
    catch (e) {


function setAddButtonDisplayNone(subgridId) {
    var imageId = subgridId + "_" + "addImageButton";
    if (imageId) {
        document.getElementById(imageId).style.display = 'none';
    //var imageId2 = subgridId + "_" + "addImageButtonImage";
    //document.getElementById(imageId2).style.display = 'none';

function addEventToGridRefresh(subgridId, functionToCall) {
    // retrieve the subgrid
    var grid = document.getElementById(subgridId);
    // if the subgrid still not available we try again after 1 second
    if (grid == null) {
        setTimeout(function () { addEventToGridRefresh(subgridId, functionToCall); }, 1000);

    // add the function to the onRefresh event

    var imageId = subgridId + "_" + "addImageButton";
    if (imageId) {
        if (document.getElementById(imageId).style.display.toLowerCase() == "block") {

How to Call

Just use this code to call:

And here enjoy the result




*After applied:


*Note: This is undocumented in SDK, so use as per your own risk, I need this as the must-to-have requirement so that I have to try workaround to make it happened to the customer.

Hope this helps!


  1. Nice writeup about CRM. If you want to buy best crm software solutions please contact us from the links below

    The online CRM software topic of discussion here is very much serious as well as they are all counting regarding the CRM Software Solutions CRM tool as well as its advantages. Make this a must for your all custom crm solutions possibilities and within quick time you will start feeling up the change. Business as well as all related aspects is carefully managed by this new custom built crm tool.

  2. The sales lead follow up article is very much point base and there are all details and crm management software important aspect counted about CRM. The point is very clear and the tool is already known to create all buzz in the market. There are custom crm development serious and higher end benefits found to work for the CRM tool. For every business it is something that is proving quite a dealer crm worth.

  3. Hi, can i know the code should call it from where?

  4. document.getElementById() is returning null value when I try to get the grid on a form.

  5. Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. We are top CRM Software | CRM Software Mumbai | CRM Software Provider | CRM Software Pune | Field Management Software | CRM Software India

  6. EventTitans is the hybrid event management software where Event Interactions made Ever Powerful and Highly Flexible.Satisfy all of your event management needs with EventTitans, the comprehensive and innovative hybrid solution.
    virtual event platform
    event management software
    event engagement platform
    event website builder
    online event ticketing
    hybrid event platform
    event registration platforms


My Name is..