How do I create a hyperlink from a company lookup?

From SmartWiki
Jump to: navigation, search

Q: How do I create a hyperlink from a company lookup?

A: You need to do the following steps to configure this.

1. Create the following custom fields.

Lookupscript.jpg

2. Inside the Display Only - Text or System Object field, you will have the following code in the text/link value.

<a href='/s_viewcompany.jsp?companyid=' id='companyLink' target='_blank'></a>

3. Inside the Special - Browser Script field, you will have the following code.

function buttononclick(){
    var companyid=document.frmevent.d_cf_1475115.value;
    if(companyid==null||companyid.length==0)companyid=document.frmevent.cf_1475176.value;
        var linkObject=document.getElementById("companyLink");
        linkObject.href="/s_viewcompany.jsp?companyid="+companyid;
        linkObject.innerHTML=document.frmevent.cf_1475115.value;
        document.frmevent.cf_1475176.value=companyid;
}
document.onmousemove=buttononclick;