Using error codes in business rules

Error codes are used within a business rule so that the output can be translated. Error message is only populated when the business rule is called from the parent map.

If business rule output is not set to specific error code or set to an invalid error code, a message appears stating "error not found".

After completing business rule evaluation, localized error code message (if configured) appears automatically based on the locale. For a form, the message appears based on the locale of the browser; for a process, it appears based on the locale of Core Worker.

To use an error code in a business rule, use the following procedure:

  1. Make sure that the required error codes are available.

  2. Create a business rule.

  3. Create a String variable.

  4. Add an Expression activity .

Create String variable

If the output variable is set to String, you can set error code or error code message.

  1. Click for New variable.

    The New variable dialog box is displayed.

  2. Enter a unique Name for the variable.

    By default, the name of the variable becomes the ID of the variable; however, you can change the ID if needed.

  3. On the Type list, select String. (Default: String)
  4. To set the variable as output, select Output and provide a value.
  5. Select Error code or Error code message (default: Static) for Value.
  6. Click Add another to add as many variables as needed without navigating away from the New variable dialog box, or click Add and close to add one variable and close the dialog box.

Add an Expression activity

Configure the Expression activity to define a rule for performing operations on data.

  1. Add activity to the map.

    By default, the Configuration tab is open in the properties panel of the activity.

  2. Change the default Name of the activity to something meaningful.
  3. On the Type list, select Common > Expression.
  4. Click for Configuration.

    The Expression dialog box is displayed.

  5. On the Target variable list, select the variable you created for holding error code or error code message.
  6. Optional. Enter a Description for the expression node.
  7. Right-click on the rule editor and define an Expression using the Error code.
  8. To validate the expression, click Validate.

    If the expression rule is invalid, an error message appears stating "error not found".

  9. Optional. To ensure the results and format are as expected, click Test.

    The Test expression dialog box displays the variable values.

  10. Click Execute test.

    The expression is executed and the test result is displayed showing the Error code message. You can change the variable values and retest the expression, if needed.

  11. Click Add.
  12. Save or release the process map.