Sage CRM uses JScript as its internal scripting language. And within JScript string literals can be included in your scripts by enclosing them in matching pairs of single or double quotation marks. Double quotation marks can be contained within strings surrounded by single quotation marks, and single quotation marks can be contained within strings surrounded by double quotation marks.

The order of usage in Sage CRM scripts is important because the onChange scripts themselves must be rendered out to the browser as part of the screens HTML. This is whether the scripts have been written for a screen like the opportunitydetailbox or for dynamically rendered fields created as a result of workflow actions.

So if we consider this example of a rule created to govern the maximum value allowed in the oppo_certainty field defined in the opportunity fields used in workflow

if (this.value >10)
{
this.value = 10;
window.alert('Maximum value of certainty at this stage is 10');
}

This is added to the screen HTML like this:

<input type="text" CLASS=EDIT ID="comp_name" name="comp_name" value="10" onChange="if (this.value >10) {this.value = 10;window.alert('Maximum value of certainty at this stage is 10');}
" >

You will need to have use 'single quotation marks' to define your string literals used in the onChange script because CRM wraps the code of the onChange event "double quotation marks" automatically.

If you need to use nested quotes within the output string then use an escape character. Escape characters are special characters that allow you to include in strings some characters you cannot type directly. Each of these characters begins with a backslash. The backslash is an escape character you use to inform the JScript interpreter that the next character is special.

e.g.

\' Single quotation mark
\" Double quotation mark
\\ Backslash