Testing JavaScript in Event Designer

You can test JavaScript expressions to ensure that the JavaScript syntax is correctly constructed.

About this task

To ensure that there are no syntax errors flagged at run time when the event runtime attempts to resolve the JavaScript expression, you can test the JavaScript expression in Event Designer.

In the Event Explorer view, open the business object, event, or action asset in which you want to use a JavaScript expression.

Procedure

  1. In the relevant field Definition section, select Javascript as the Definition Type. Enter the JavaScript expression.
  2. When the JavaScript expression is complete, click Test JavaScript.
  3. The Assign Temporary Values window opens. Enter suitable test values for each of the fields listed in the Name column. The Name column lists all of the fields that are used in the JavaScript expression. If a value field is left blank, the corresponding field is replaced with "NULL" in the JavaScript expression. All of the fields are substituted, with either the test values that you enter or "NULL".
  4. Click Run. The test values are substituted into the expression and the resulting JavaScript code is executed.
  5. The Console view opens and the JavaScript Test Results are displayed.
  6. If there are any errors reported, correct the JavaScript expression and test the updated code.

Example

The following screen captures show the sequence used to test the JavaScript expression used in a field called minutes added.

Enter the JavaScript expression and then click Test JavaScript.

Testing the JavaScript expression

Enter suitable test values for the fields used in the JavaScript expression and click Run.

Entering the test values for the fields

Check the JavaScript Test Results to see whether the test is successful.

The JavaScript test results