Calling ASP Pages from Classic Dashboard Blocks

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Calling ASP Pages from Classic Dashboard Blocks

  • Comments 5
  • Likes
In versions earlier than Sage CRM v7.0, the classic dashboard tab of the My CRM area is a customizable page that contains information most relevant to the way a user may work.

The classic dashboard can display report graphics, links to reports, and information contained in different types of blocks which are made available by the System Administrator.

The most commonly used blocks are
  • Chart Blocks
  • File Blocks
  • List Blocks
Where derived or customized information needs to be shown that is not easily represented by a report or a list block then you may wish to use an ASP page. To include an ASP page in the classic dashboard you will need to use a content block.  
Note:  From Sage CRM v7.1 content blocks can also be used in the new Interactive Dashboard.

The content block will contain jscript code that will build the path to the ASP page. The ASP page will then be shown within an <IFRAME>.

In the example code below there is a function called 'callPage'. You can pass the name of the ASP page as a parameter to the function and it will build the path including the correct session and context information that will allow the ASP page to use eware blocks.

if (window.addEventListener)
//firefox way of binding an event
window.addEventListener("load", callPage("test.asp"), false)
if (window.attachEvent)
//IE exclusive method for binding an event
function callPage(strPageName) 
var SID = ""; 
var strPath = document.URL; 
var arrayApp = strPath.split("eware.dll"); 
var arrayFullKeys = strPath.split("?"); 
var arrayKeys = arrayFullKeys[1].split("&"); 
for (var i=0;i<arrayKeys.length;i++) 
var arrayValue = arrayKeys[i].split("="); 
if (arrayValue[0].toLowerCase()== "sid") 
SID = arrayValue[1]; 
var strNewPath = arrayApp[0] + "CustomPages/" + strPageName +"?SID="+SID+GetKeys() 
document.write("<IFRAME WIDTH=100% src='"+strNewPath+"' height=height=120 width=120 frameborder=0 scrolling = 'no'></IFrame>"); 


In the ASP page called you will probably want to supress the display of a tab group. e.g. Response.Write(CRM.GetPage("none"));
  • Hi Jeff,

    This script is not correct, and I beleive its only really working by chance (I understand this is a blogpost but the same script is included in the documentation)

    window.attachEvent takes a function as its second parameter, but by putting brackets after callPage (and in fact a parameter) you are passing the result of executing the callPage function into window.attachEvent (which is null because it doesn't return anything).

    You would need a closure to bind the parameter with the method, which would be then passed as a parameter to attachEvent.

    On the other hand however, I can't really see why you would want the callPage function to run after the page has loaded, particularly as it uses the (deprecated) document.write, which, should it run after the document has loaded, would insert the iframe at the end of the document.

    Simply changing




    would be my recommendation


  • My hands are up!  You are correct the attachEvent() is unnecessary.

  • Hi Jeff, Can we change the height and width of the content block .The height and width property is not working .Its considers only the long block and double width property. For example if we add a list with a chart as an asp page in the dashboard , it only shows the chart .

    It Shows both if we change the scrolling='y'  for the iframe .  Can we have custom height and width.

  • Hi Jeff,

    Yes its easy, i think content block doesnt considers the height and width property. We can change the width and height  by changing the iframe code to <IFRAME WIDTH=100% src='"+strNewPath+"' height=500 frameborder=0 scrolling = 'no'></IFrame>

  • Shayju

    That's good to know.