UI policies

UI policies dynamically change information on a form and control custom process flows for tasks.

Client scripts for UI policies

You can use different options in the UI Policy form to control when and how the UI policy is applied. These options include client scripts, OnLoad execution, and view-specific UI policies. Administrators can use the UI Policy form to create client scripts that run onChange when the UI policy conditions are met (Execute if true) or not met (Execute if false).To display these scripting fields in the UI Policy form, in the Script section, select the Run scripts check box.

For example, to display an alert to the user when the incident State field changes to Resolved, create the following script in the Execute if true field.
function onCondition(){
alert('You changed the "Incident state" to Resolved. Please enter your comments in the "Close notes" field.');
}

Convert a UI policy to a data policy

To make a UI policy the default setting, convert the UI policy to a data policy.

Before you begin

Role required: ui_policy_admin

About this task

You can also apply a UI policy to import sets or to data imported by SOAP web services when you convert it to a data policy. Converting a UI policy to a data policy deactivates the UI policy. To retain the policy in the UI, ensure that the Use as UI Policy on client check box is selected on the data policy record.

For a UI policy to be eligible for conversion to a data policy, the following conditions must be met on the UI Policy form.
  • The Run scripts check box must be cleared.
  • The Global check box must be selected.
  • None of the UI policy actions can have Visible set to True or set to False. Visible must be set to Leave Alone.

Procedure

  1. Navigate to System UI > UI Policies.
  2. Open an existing UI policy.
  3. Under Related Links, click Convert this to Data Policy.
    A new data policy record is created.
  4. Edit the fields on the data policy record as necessary.

Example: creating a UI policy

Create a UI policy to implement controls in the Incident form when the state changes to Resolved.

Before you begin

Role required: ui_policy_admin

About this task

This example demonstrates how to implement the following controls.
  • Make a Close Notes field mandatory.
  • Hide the Opened by field.
  • Make the Priority, Severity, and Urgency fields read-only.
  • Run a client script that displays an alert message.

Procedure

  1. Navigate to System UI > UI Policies.
  2. Click New.
  3. Supply the following information.
    Table 1. New UI policy
    Name Input
    Table Incident
    Conditions [Incident state] [is] [Resolved]
    Reverse if false Select this check box. If the incident state is not Resolved, the UI policy is reversed.
    On load Select this check box to perform the actions when the form is loaded or when the condition changes.
  4. Right-click the form header and select Save from the context menu.

    The UI Policy Actions related list appears.

  5. In the related list, click New.
  6. Provide the following information.
    Table 2. New UI policy actions
    Name Input
    Field name Close notes. This UI action makes the Close notes field mandatory.
    Mandatory True
    Visible Leave alone
    Read Only Leave alone
  7. Click Submit.
  8. Repeat the process to create UI policy actions to hide the Opened by field, and to make the Priority, Severity, and Urgency fields read-only.