Those implementing Sage CRM may encounter issues around the performance of client-side JavaScript. These issues may be difficult to troubleshoot; while all major browsers include JavaScript profiling tools as part of their development tools, these may provide more information than is useful when attempting to identify the cause of an issue.

More information:

Basic console logging can be added quite easily to any client-side script. Consider the following Custom Content script:


var scriptStart = new Date();

DoLog ("Custom Content script written to page");

function DoLog (str) {

    var now = new Date();
    console.log("Timestamp: " + (now.getTime() - scriptStart.getTime()) + "ms. Message: " + str);
    now = null;

// Run this when the CRM page loads
crm.ready(function () {

    DoLog("CRM screen loaded. Inner code starting")

    // Carry out a useless function to demonstrate execution time.
    var myCounter = 0;

    while(myCounter < 1000000) {


    DoLog("Script complete");

The scriptStart Date variable takes note of the exact date and time as soon as it is written to the page. Since we are using a Custom Content script, this is when the top of screen containing the script is written to the page, and before the page itself has completed rendering.

The DoLog function takes note of the exact date and time that it is called, and writes out the number of milliseconds since scriptStart was written to the page, as well as a custom log message.

In our example, we have added logging at the following points:

  1. Immediately after scriptStart has been written to the page (i.e., as soon as the script has been returned to the browser by the CRM server).
  2. Once crm.ready() has been called. This function is called as soon as the CRM page has finished rendering.
  3. On completion of a some placeholder code in the custom content script.

By hitting F12 after loading the page, we can examine the logging written out to the browser's development tools. The developer tools are bound to F12 if you are using Internet Explorer or Chrome. If you are using Firefox's Firebug plugin (which is recommended), this will also be bound to F12.


 Console performance logging

From this, we can see that there was a delay of 152ms between the logging function being written out to the browser and the crm.ready() function being called. After this, there was a further delay of 3ms while the placeholder While loop completed.

The above testing method has the advantage of not interrupting the flow of the custom script - you are not dependent on user interaction or disruptive Alert boxes to measure performance.


If you are interested in carrying out further performance testing, it is suggested that you make use of the Profiler / Audits tab in your browser development tools of choice, or the Fiddler HTTP debugging proxy (if your script is dependent on asynchronous HTTP requests).