Sage CRM 7.2 Client Side API Manipulate List Block Columns

By | May 3, 2014

Grid customizations in Sage CRM are bit time consuming and sometimes need complex coding. But with Sage CRM client side API it has become much easier to work with grid customizations. One of our clients came up with requirement that there should not be an hyperlink on Quote Items grid. Now, this hyperlink is not set by using Hyperlink To in list customization so that we can change and remove the hyperlink.

Related Post: SageCRM 7.2 URL parameters through Client Side API

This can be achieved by using client side API exec function. This executes a function on each of selected cell. This function will get text of the cell and will set it as HTML. Again, there are two methods named getCellText and setCellHtml which can be used to get text of the cell and set it as html.
Here is the script I have written to remove hyperlink as mentioned above.
<snippet>
var indexOfColumn = 1;
        crm.grids(“0”).rows().cells(indexOfColumn).exec(function (index, key) {
            var rowIndex = $(key).parent().index() – 1; //This is used to get the row index of the cell. $(key) = the current cell
             //’Get CellText and Set it as CellHtml
            crm.grids().column(‘prod_name’).setCellHtml(rowIndex, crm.grids().columnIndex(“prod_name”), crm.grids().getCellText(rowIndex, crm.grids().columnIndex(“prod_name”)));
        });
 </snippet>