Sage CRM 2021: Setting up hyperlinks on field contained in a TopContent Screen.

1 minute read time.

You can see here that I have created a hyperlink to a custom extension in Sage CRM.

This has the URL.

http://[servername]/[instancename]/eware.dll/Do?SID=31011801232768 &Act=432 &Mode=1 &CLk=T &Key0=1 &Key1=765 &Key2=1256 &T=Company &dotnetdll=ExamplePageSwitcher.dll &dotnetfunc=RunSwitcher &comp_customerno=1200

The link calls the dll 'ExamplePageSwitcher' and the function 'RunSwitcher' and passes in the value of the field 'comp_customerno'. That last field is a custom field.

I added the field to the Top Content area by editing the screen 'CompanyTopContent'.

Administration -> Customisation -> Company

It is not possible to add the hyperlink to the field using the Create script box. But it is possible to use client side script to do this.

But if the field is just added to the screen with no further customization then it will appear just containing the data.

The client side script to add the hyperlink can either be added to the Custom Content box of the CompanyTopContent screen or added as a JavaScript file using the custom script folder.

C:\Program Files (x86)\Sage\CRM\[instancename]\WWWRoot\js\custom

The script can rely on the fact that fields added to the Top Content area are clearly identified.

The script that will change the URL will be slightly different depending on where it is added.

Script in the Custom Content Box

Script in the Custom File

C:\Program Files (x86)\Sage\CRM\CRM\WWWRoot\js\custom

crm.ready(function () {
var contextInfo = crm.getArgs();
// crm.infoMessage(contextInfo.Act);
//Set up Company Screen
if (contextInfo.Act == "200") {
var myElement = document.getElementById("_Data_TopContentcomp_customerno");
var strCustomerNo = myElement.innerHTML;
var strLink = "" + strCustomerNo + "";
myElement.innerHTML = strLink;
}
}
)