An issue may occur in versions 7.1 and 7.2 of Sage CRM whereby a JavaScript error appears when attempting to file an email from a contact that does not exist in CRM. This issue will only occur in instances of Sage CRM that are integrated with Sage 200.


The issue can be reproduced when using the Exchange Lite plugin (installed to Outlook clients when the Exchange integration is enabled). On filing an email from an unknown contact against a company and person that exist in CRM, but are not linked to Sage 200, the following JavaScript error will be displayed:

An error has occurred in the script on this page.

Line: 30
Char: 1953

Unable to get value of the property 'value': object is null or undefined.

URL: http://crm-server/crm/eware.dll/Do?Act=6011...


The issue is caused by a client-side script referencing cmli_comm_accountid and _HIDDENcmli_comm_accountidTEXT, which do not exist on that screen.

Work around:

If using a copy of Sage CRM on a version prior to v7.2e, the issue can be worked around by amending the FilIt -> FileCRM custom caption with the following:

E-mail Target
window.attachEvent("onload", function () {

    if (document.location.href.indexOf("Act=6011")>-1) {

        var allLinks = document.getElementsByTagName("a");
        var tempOnClick = "";

        for (var i=0; i<allLinks.length; i++) {

            tempOnClick = allLinks[i].onclick+"";

            if (tempOnClick.indexOf("saveTarget")>-1) {

                allLinks[i].onclick = Function("case145105(); getSelection(); if(validateTarget()) {saveTarget();}");

function case145105() {

    if (!getElm("cmli_comm_accountid") && !getElm("_HIDDENcmli_comm_accountidTEXT")) {

        var dummy1 = document.createElement("input"); 
        with (dummy1) { type = "hidden"; id = "cmli_comm_accountid"; value = "-1"; }

        var dummy2 = document.createElement("input");
        with (dummy2) { type = "hidden"; id = "_HIDDENcmli_comm_accountidTEXT"; value = "";}

function getElm (a) { return document.getElementById(a);}



This issue has been resolved by a code change in v7.2e.