CRM 2013, hide subgrid column using javascript RRS feed

  • Question

  • Hi,

    I use the following code to retrieve each cell value in a connection subgrid in Opportunity form.  Is there a way in javascript I can hide the second column in this subgrid?  Thanks.

        var gridControl = document.getElementById("subgrid_xxxxxx").control;
        var cellNameValue;
        var cellRoleValue;

        var ids = gridControl.get_allRecordIds();
        for(var i = 0; i < ids.length; i++) {
               cellNameValue = gridControl.getCellValue("record2id", ids[i]);
               cellRoleValue = gridControl.getCellValue("record2roleid", ids[i]);          

    Thursday, December 4, 2014 11:06 PM

All replies

  • Hi,

    You can remove the columns directly from the view which you have set in the subgrid. Go to Views--> remove Columns.

    Have a look at the below link for where you set the view in subgrid.


    Unless you want to hide them dynamically based on values in form.

    Hope this helps!!!



    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, December 5, 2014 5:27 AM
  • Hi, Prasad-

    Thanks for your reply.  Because I could only use non-customizable Managed View in this 2013 Sub grid, I wasn't able to remove the column in view.  One option is to hide the column dynamically in programming code, such as JavaScript.

    Friday, December 5, 2014 3:15 PM
  • Hi,

    Hiding the control using javascript DOM is unsupported.You may face problem when you do rollup update or migration.

    If the view is managed, better to create a new view with the required columns and use subgrid's default view.



    Friday, December 5, 2014 3:36 PM
  • HI, Seban-

    Thanks.  That's what I tried to do first to create another view which hides the column.  However, after I load the custom view to subgrid, the + button disappear.  It seems to me the subgrid only show + button if the view is a managed view.  I also tried to create a new managed view, no luck.  BTW, this is 2013 online CRM.  After spending a lot of time, I went back to the existing managed view and trying to use javascript to hide the row.

    Friday, December 5, 2014 9:09 PM