Business Condition: Evaluate JavaScript

In addition to the standard business rule operations, more complex functions can be carried out using JavaScript and the Scripting API. This condition enables you to use the same STEP Public Java API methods that are available in the Execute JavaScript business action operation.

Conditions contain tests, and the JavaScript should only evaluate to true or false.

Important: Business conditions are optimized for determining the true / false result of read-only scenarios. Although it is technically possible to write business conditions to change data, doing so can result in unpredictable errors and should therefore not be attempted. To change data effectively, use a business action and the Execute JavaScript operation. For more information, see the Execute JavaScript section of the Business Rules documentation here.

Using JavaScript in business rules can include:

Prerequisites

Before using this business condition:

  1. Understand the implications of using JavaScript as defined in the Java vs. JavaScript topic in the Resource Materials online help here.
  2. Understand the considerations that should be taken as defined in the JavaScript Considerations topic in the Resource Materials online help here.
  3. Create a business rule as defined in the Creating a Business Rule or Library topic here.
  4. Edit the business rule to configure the operation as defined in Editing a Business Rule topic here.

Configuration

  1. On the Edit Operation dialog, select Evaluate JavaScript from the dropdown.
  1. For the Binds parameter, create binds needed for the JavaScript code as described in the Adding a Bind topic in the Resource Materials online help here.
  1. For the Messages parameter, create messages needed for the JavaScript code as follows:

  1. For the JavaScript parameter, add the JavaScript code.
  2. Click the Save button to add the operation to the business rule editor.