Summary:

Commenting out the last line of an OnChange script on the CommWebPicker screen may result in a scripting error in the Outlook plugin. This applies for both the Exchange plugin and the Outlook Lite plugin. 

Symptoms:

Selecting a Company record when filing an email from Outlook may result in the following error message:

Script error on line 51 - ID is not defined.

Cause:

In Sage CRM, the content of an OnChange script is written directly to the screen HTML. This is also the case for Custom Content scripts.

In the Outlook plugin, no newline character is written out after the Onchange script. This causes an issue with the end of the OnChange function, and the next function, which starts on the same line. The error is demonstrated as follows:

function OnChangecmli_comm_companyid(){//This is a comment in an OnChange script}function SetIDcmli_comm_companyid(ID){
    if(!ID)return;
    u=getParentEntryForm('inlineurlcmli_comm_companyid').inlineurlcmli_comm_companyid.value;
    u+='&ID='+ID;
    u+='&ForceSubSelect=Y';
    $('#SEARCHFRAMEcmli_comm_companyid').attr('src',u);
}

If the commented-out line is the last one in the Onchange script, then the SetIDcmli_comm_companyid function will not work – the ID parameter will be undefined.

Status:

A fix for this case is included in the 7.2j patch, scheduled for release at the end of October 2015.

In earlier versions of Sage CRM, the issue can be worked around in one of two ways. The first is to ensure that the last line of the OnChange script does not contain a comment. Alternatively, using block quotes /* like these */ will prevent the issue from occuring.