Remove hyperlink from list column based on value in other column

By | February 13, 2012

We can create List objects for CRM entities and add them to custom pages to load on specific tab. We can link list columns to existing entities or custom pages using Hyperlink to or custom junk functionalities available in List editing feature. However we came across the requirement where hyperlink on person name needed to be disabled based on the status value of list entity record. Please refer the screenshot below.
We can see the hyperlink on person name for the status Approved. Clicking this hyperlink opens the new pop up window in which you can see the summary page for that particular entity record, however when status is Submitted the hyperlink needed to be disabled. Below is the client side script we had designed to achieve the functionality.
function RemoveUserHyperlink(oMyGrid)
{
if(oMyGrid)
{
var rowNum =1
var rowElem
while (rowNum < oMyGrid.rows.length)
{
rowElem = oMyGrid.rows[rowNum];
//to get the fourth row values
LinkTo = new String(rowElem.cells[rowElem.cells.length-1].innerText);
if(LinkTo==”Submitted”) //if submitted found
{
//to get the third row values
LinkText = new String(rowElem.cells[rowElem.cells.length-2].innerText);
rowElem.cells[rowElem.cells.length-2].innerText=LinkText;
}
rowNum++
}
}
}
You have to pass the grid object to this function. You can find the below article on partner community to understand how to access grid objects from client side script.
https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2009/07/27/the-clientside-of-control-of-lists-and-columns.aspx