Update header information
Sometimes it can be usefull to have some more information in the header of an entity. When switching to an activity history overview, sometimes seeing the account name is just not enough. This can be fixed with some very easy javascript.
In the code we first loop through the td elements to find a td element which has a class of formTitle assigned to it. This td contains the header text. We just add any field we want to it.
javascript:
var doc = document.getElementsByTagName('td');
for (var i = 0; i < doc.length; i++)
{
if(doc[i].className == "formTitle")
{
var header = doc[i].innerText;
//address1_line1
if (typeof(crmForm.all.address1_line1) != "undefined" && crmForm.all.address1_line1 != null)
{
if(crmForm.all.address1_line1.DataValue != "" && crmForm.all.address1_line1.DataValue != null)
{
header = header + " | " + crmForm.all.address1_line1.DataValue;
}
}
doc[i].innerText = header;
}
}
In the code we first loop through the td elements to find a td element which has a class of formTitle assigned to it. This td contains the header text. We just add any field we want to it.
javascript:
var doc = document.getElementsByTagName('td');
for (var i = 0; i < doc.length; i++)
{
if(doc[i].className == "formTitle")
{
var header = doc[i].innerText;
//address1_line1
if (typeof(crmForm.all.address1_line1) != "undefined" && crmForm.all.address1_line1 != null)
{
if(crmForm.all.address1_line1.DataValue != "" && crmForm.all.address1_line1.DataValue != null)
{
header = header + " | " + crmForm.all.address1_line1.DataValue;
}
}
doc[i].innerText = header;
}
}

1 Comments:
Hi may I suggest and ask if you can you also provide an image for a sample output using this code?
That way it would be easier for some readers to understand what you're trying to achieve :)
Hope it's alright?
By
naughtyian, at 10:56 AM
Post a Comment
<< Home