Field and Form Rules for Request Templates
This document guides you through the process of defining rules that can be executed on a Request form. Field and form rules are executed during the following conditions: after a request form is loaded, when some field in the form is changed and before a request form is submitted. The rules can be disabled or enabled, wherein the disabled rules will not be applied.
Types of Events Supported in Field & Form Rules
The following three types of events are supported:
On Form Load: This allows the rules to be executed when the request form is loaded. The rules defined on this event should contain at least one executable action. The actions will be executed after checking criteria; if no criteria is defined, the actions will be executed directly.
On Field Change: This allows the rules to be executed, when there is a change in the field value. The rules defined on this event should contain at least one executable action. The actions will be executed after checking criteria; if no criteria is defined, the actions will be executed directly. The rule will be applied on change of the field value mentioned in the rule.
On Form Submit: This allows the rules to be executed on submission of the request form. Here, "Execute Script" is the only action allowed for the event. The rules defined on this event should contain a valid script. The script will be executed after checking criteria; if no criteria is defined, the script will be executed directly.
Types of Users
The rules can be applied to Requesters or Technicians or All users. However, the rules that are applied to Requesters only will not be applied to Technicians, and vice versa.
Execution of Rules
The rules can be executed on creating a new request, or on editing an existing request, or on both of the operations.
Types of Actions Supported in Field & Form Rules
Show Fields : This action shows the fields in the request form, on which the action is applied.
Hide Fields : This action hides the fields in the request form, on which the action is applied.
Enable Fields : This action enables the fields in the request form, on which the action is applied. As a result, the user will be able to edit those fields.
Disable Fields : This action disables the fields in the request form, on which the action is applied. As a result, the user will not be able to edit those fields.
Mandate Fields : This action makes the fields mandatory in the request form, on which the action is applied. As a result, the user will not be able to submit the form without filling values for those fields.
Non-Mandate Fields : This action removes the mandatory properties of the fields in the request form, on which the action is applied. As a result, the user will be able to submit form without filling values for those fields.
Add Options: This action adds options to the drop-down list of the field in the request form, on which the action is applied.
Remove Options: This action removes options from the drop-down list of the field in the request form, on which the action is applied.
Set Field: This action sets the chosen option for the field in the request form, on which the action is applied.
Clear Fields: This action resets the field in the request form, on which the action is applied.
Set Task: This action sets the associated tasks in the request form. As a result, the specific task is automatically triggered on submitting the form.
Unset Task: This action unchecks the associated tasks in the request form. As a result, the specific task will not be triggered on submitting the form.
Show Task: This action displays the selected tasks associated to the request template.
Hide Task: This action hides the selected tasks associated to the request template.
Execute Script : This action executes the script in the request form. The script should be a valid JavaScript code; otherwise it will not be executed. Some methods are supported as default methods in script execution, for example, to hide Category and Level fields you can call the below method with an array of fields as: $CS.hideField(["CATEGORY","LEVEL"]);
Copying Rules To Another Template
You can copy one or more rules from one template to another, using copy rule action provided in Actions menu. While copying the rule, if a particular field does not exists in the other request template, then that field will not be copied. Also, if for a rule, no criterion/action can be copied, then that rule will not be copied.
Removing Fields from Request Form
Removing fields from a template automatically removes those fields from the rules defined in that template as well. After deleting the fields, if for some rule no criterion/action is left out, then that rule will also be deleted.
Operations performed on Rules
Creating a New Rule
To create a field and form rule,
-
Go to Admin > Helpdesk Customizer > Incident Templates. For service templates, go to Admin > Service Catalog > Service Catalog.
-
In the displayed list of incident/service templates, click the desired template.
-
Access the Field and Form Rules tab. The Rules wizard is shown. From here, you can create a rule for any of the below events:
-
On Form Load
-
On Field Change
-
On Form Submit
-
- Click the Create New Rule button. The Create New Rule form is shown.
- Fill-in the following details:
i. Rule Name: Enter an appropriate name for the rule.
ii. Applies to: Choose if the rule needs to be applied to All Users, or Technicians, or Requesters. (See this)
iii. Rule Execution: Choose when to execute the rule; On Create / Edit, or On Create, or On Edit.
iv. Event: Select the event for which the rule needs to be executed:
"On Form Load":
a. Conditions: Choose a condition to be checked while executing the rule. You can add a single condition, or multiple conditions by clicking the icon.
Condition Format:
<Select Field>
<Select Criteria>
< Select Value>
Example:
Level
is any of
Tier2 Tier3b. Actions: Choose an action to be performed while executing the rule. You can add a single action, or multiple actions by clicking the icon.
Action Format:
<Select Action>
<Select Field>
Example:
Disable Fields
Group Impact Level Priority
c. Click Save. The created rule can be viewed from the Rules List View under On Form Load.
"On Field Change":
a. Conditions: Choose a condition to be checked while executing the rule. You can add a single condition, or multiple conditions by clicking the icon.
Condition Format:
<Select Field>
<Select Criteria>
< Select Value>
Example:
Technician
is not
administrator
b. Actions: Choose an action to be performed while executing the rule. You can add a single action, or multiple actions by clicking the icon.
Action Format:
<Select Action>
<Select Field>
Example:
Disable Fields
Priority Level
c. Click Save. The created rule can be viewed from the Rules ListView under On Field Change.
"On Form Submit":
Conditions: Choose a condition to be checked while executing the rule. You can add a single condition, or multiple conditions by clicking the icon.
Condition Format:
<Select Field>
<Select Criteria>
< Select Value>
Example:
Request Type
is not
Incident
and
Category
is any of
Internet Network
Actions: Only Execute script action is allowed for this event. You need to Write Custom Script. Click the link to View Script. You can view the Sample Script at the right side. Write your Script Code in the left panel and Save it.
Click Save. The created rule can be viewed from the Rules List View under On Submit Form.
Editing/Deleting a Rule
-
Go to the Rule List Wizard under any of the required events: On Form Load, On Field Change, or On Form Submit.
-
Editing: Click the icon against the required Rule. Make the required changes in the Edit Rule form and Save the changes.
-
Deleting: Click the icon against the required Rule. Say OK in the confirmation window displayed. The rule is removed from the Rule List.
Bulk Actions
You can perform certain bulk actions on the rules. Follow the steps below:
-
Go to the Rule List Wizard under any of the required events: On Form Load, On Field Change, or On Form Submit.
-
Mouse hover the Actions menu to view the bulk actions.
-
Delete Rules: Select the check boxes of the rules you wish to delete. Click DeleteRules under Actions. Say OK in the confirmation window displayed. The selected rules will be removed from the Rule List.
-
Disable/Enable Rules: Select the check boxes of the rules you wish to disable/enable. Click Disable/Enable Rules under Actions. The disabled/enabled rules will be marked with and icons, respectively.
-
Copy Rules: You can copy rules from one template to another. Select the check boxes of the rules you wish to copy. Click Copy Rules under Actions. A window pops up. Choose the required templat from the available list and click Copy. Now, all the selected rules will be copied to the chosen template.
Use Cases for Field & Form Rules
A more clear understanding of the field & form rules can be acheived by using real time use cases. Click here to view the document that explains the use cases in detail.