Advanced rules for request types

You can create advanced rules that include logic to automatically populate a specific request field based on user entries. You can also use advanced rules to automatically change field attributes such as whether the field is visible or hidden and editable or read-only.

Before configuring advanced UI rules

Configuring advanced default rules requires knowledge of SQL or JavaScript.

We recommend that you review the following before you configure advanced UI rules:

Back to top

Create advanced request type rules

Follow steps below to create advanced UI rules for request types.

  1. Log on to PPM.

  2. On the Open menu, click Administration > Open Workbench to open the PPM Workbench.

  3. On the shortcut bar, click Demand Mgmt > Request Types.

  4. Open a request type for which you want to create an advanced rule.

  5. In the Request Type window, click the Rules tab.

  6. Click New to open the Request Type Rules window.

  7. In the Rule Name field, type a name for the rule.

  8. In the Description field, type a short description of the rule.

  9. To implement this rule, in the Enabled? field, select Yes.

  10. From the Rule Event list, select an event to trigger the rule. For details on the selectable events, see Rule Event Behavior on the Request Details Page.

  11. From the Rule Type list, select Advanced and click Yes to continue.

    The Request Type Rules window switches to the advanced mode.

  12. If the results of the new rule might trigger rules defined for the same event (same dependency) that occur later in the rules sequence, and you want to prevent that from occurring, select No for the Processing cascading rules? option.

  13. To set up a dependency:

    1. In the Dependencies section, click New.

    2. Use the Field list to select a field to trigger the rule.

      Tip: After the Validate window opens, expand it to the right so that you can view all displayed columns.

      Note: You cannot configure request default rules to trigger from a multiple select auto-complete. Do not select a multi-select auto-complete field.

      After you select a field, the following read-only fields are populated:

      • Field Type. Displays the type of field you selected.

      • Validation Name. Displays the type of validation (such as CRT - Assigned To - Enabled) for the field you selected.

      • Visible Token. Displays the name of the visible token (such as REQ.ASSIGNED_TO_NAME) for the selected field.

      • Token. Displays the name of the token, (such as REQ.ASSIGNED_TO_USER_ID) for the selected field.

      The field you select determines which items are available in the Condition list.

    3. From the Condition list, select one of the following:

      • A condition such as is null,contains any value, or is not null.

      • A condition to use to compare the value in the selected field with a constant, which you must then specify.

      • A condition to use to compare the value in the selected field with a value in a different field, which you must then specify.

    4. If you selected a condition other than is null, contains any value, or is not null, then from the list displayed to the right, either leave constant value selected or select another field value.

    5. Do one of the following:

      • If you selected constant value, provide the value for comparison in the Value field. The format of the Value field varies depending on the specific field, such as a list, auto-complete, or text box.

        Caution: If your PPM instance supports multiple languages, and you specify a numeric field as a dependency, make sure that you always use the English format to specify field values.

        Example: Suppose a request type includes a numeric field, and you want to create a rule that triggers an event when the field is set to the constant value 1234.56. In this case, make sure that you use the English variant without a group separator.

      • If you selected another field value, use the Field auto-complete to select the field for value comparison.

        Caution: If your PPM instance supports multiple languages, and the other field value you specify is a numeric field, make sure the values for the other field use the English format.

    6. Click OK.

    The dependency you created is listed in the Dependencies table.

  14. In the Results section of the Rules window, click New.

  15. Use the Field auto-complete to select a field for automatic population or to change attributes like read-only or hidden as specified by the rule.

  16. Click OK to close the window, or click Add to continue specifying another field.

    The Result Fields table lists the fields you selected.

  17. To specify a rule that controls the behavior of the field(s) listed in the Result Fields table, do one of the following:

    • To specify an SQL-based rule to populate the fields:

      1. In the Logic list, select SQL Default.

      2. In the Logic field, enter the SQL statement that loads values into the field(s) you added to the Result Fields table section.

        Each SELECT value is loaded into its corresponding column in the Results table in order. The system validates the SQL statement to ensure that it includes the correct tokens: [SYS] tokens, [AS] tokens, or tokens corresponding to the fields in the Dependencies section. If the SQL statement is invalid, an error message is displayed.

    • To specify a JavaScript-based rule that changes field behavior (for example, showMessage, setFieldRequired, or setFieldVisible) but does not populate fields with values:

      1. In the Logic list, select UI Rules.

      2. In the Logic field, enter the JavaScript function.

        Caution: For the validation purposes, you cannot just type any JavaScript in the Logic text box in the Rules window. You must use a function defined in the RequestRulesSystemLibrary.js or RequestRulesUserLibrary.js file.

        Tip: To view a list of the available JavaScript functions, their descriptions, syntax, and usage, to the right of the Logic list, click ?. This list automatically includes all functions defined in both the RequestRulesSystemLibrary.js and RequestRulesUserLibrary.js files.

  18. Click OK.

  19. Click Save.

Back to top

See also: