You can use JavaScript expressions in Decision Server Events to perform various data manipulation functions, including string manipulation, mathematical calculations and array processing. JavaScript expressions can be used in business objects, event objects (in event field constructors) and action objects. The result is a value that is evaluated by the event runtime during event rule evaluation (for events and business objects) or passed to a touchpoint system (for actions).
| Color | What the color indicates |
|---|---|
| Green | Comments in the expression. |
| Blue | Character literals and string literals (including escape sequences). |
| Purple | A reference to a single instance of the field. |
| Bold purple | The field reference is to every instance of a field in an array of objects. |
| Red | JavaScript keywords. |
| Black | All other elements in the JavaScript expression. |
When you want to enter a JavaScript expression in a business object, event object (in event field constructors), or in an action object, you can use the content assist menu. To open the content assist menu, in the JavaScript expression box, press Ctrl+Spacebar. Then, double-click an entry in the available list to add the entry to your JavaScript expression. You can continue to use the content assist menus to complete your JavaScript expression.
An example of a JavaScript content assist menu is shown in the following screen capture:

For more JavaScript examples, see Examples of JavaScript in Event Designer