Field & Form Rules - Use Cases
The purpose of this document is to bring out a clear understanding of field and form rules by using real time scenario. The sections that follow walk you through the step-by-step procedure of configuring the use cases, along with relevant screenshots.
List of Use Cases
-
Applicable to all users type and executes on both edit and create request operations.
-
Applicable to requester and executes on create request operation
-
Applicable to technician and executes on edit request operation
-
Applicable to all users and executes on both create and edit operations
-
Applicable to technicians and executes on both create and edit operations
-
Applicable to all users and executes on edit request operation.
Case I: Add dependency among PickList fields
Scenario:
-
Creating Country-City-Support Rep dependency.
-
When we choose Country, City field should automatically populate with available cities of that country.
-
When we choose City, Support Rep field should automatically populate with available Support Rep in that City.
Step 1:
To handle the above use case, first we need to include fields (Country, City and Support Rep) with appropriate values in Incident Additional Fields and then add those field to any template (say, Default Template), as shown in the below image:
Step 2:
-
Create a new rule under "On Form Load" event.
- As the dependency is being creating under "On Form Load" event, it gets created only when the form is loaded.
-
Choose "Applies to All Users", so that the dependency will be applied to all users (Technician as well as Requester).
-
Choose Rule Execution as "On Create/Edit", so that the dependency will be created on both request create and edit pages.
-
Conditions can be left as empty, since we want the rule to be applied without any conditions (since dependency is applicable in all scenarios).
-
Under Actions, select the action as "Execute Script" and this will provide a link as "Write Custom Script".
-
Click "Write Custom Script" and this opens a script editor pop up.
-
Go to Dependency Example under Sample Script. Copy the complete code (you can skip comments), paste it to the Script Code area and save the script.
The Format for dependency object is explained in the below screenshot:
Here, the dependency should contain a FIELDS array and a VALUES object, where the FIELDS array should contain the fields for which the dependency should be created and where the (i)th element in the array should be depended on (i-1)th element, and so on..
Example: The City field options depend on value of Country and the Support Rep field options depend on value of the City field.
The VALUES object should contain field values, as shown in the below image. (NOTE: All the field labels and values are case sensitive)
Scenario:
-
Remove "Resolved" and "Closed" statuses from the Status Field when the Status is open.
-
Disable the Subcategory and Item fields.
-
Mandate the Category field.
Steps:
-
Create a new rule under "On Form Load" event with name (say, "custom rule CSI and status handle").
-
Set Rule Execution as "On Create".
-
Set as "Applies to Requesters".
-
Under Conditions, add a condition as Status is Open.
-
Under Actions, add an action as Disable Fields: Subcategory, Item.
-
Add another action as Mandate Field: Category.
-
Add another action as Execute Script and add script code to remove the "Closed" and "Resolved" options from the Status field.
-
Remove the "Resolved" and "Closed" statuses from the Status field using Custom Script, as shown in the below image.
Scenario:
Mandate Subcategory, if the category is any of Network, or Operating System, or Services, or Software, or Telephone. or User Administration.
Steps:
-
Create a new rule under "On Form Load event" (say, mandate subcategory).
-
Set as "Applies To Technicians".
-
Set Rule Execution as "On Edit".
-
Under Conditions, add a condition as Category is any of "Network" or "Operating System" or "Services" or "Software" or "Telephone" or "User Administration".
-
Under Actions, add an action as Mandate Field: Subcategory.
Scenario:
On change of Impact field, mandate the Impact Details Field.
Steps:
-
Create a new rule under "On Field Change" event (say, "on change of impact mandate impact details") .
-
Select "Applicable to All Users".
-
Select "On Create / Edit".
-
Select the Field as "Impact", as shown in the below image:
-
Under Conditions, add a condition as Impact is High.
-
Under Actions, add an action as Mandate Field: Impact Details
-
Save the Rule.
Scenario:
If Level selected is Tier 4, mandate the Priority and Impact fields.
Steps:
-
Create a new rule under "On Field Change" event (say, "Tier 4 Level") .
-
Select "Applies to Technicians".
-
Set Rule Execution as "On Create / Edit".
-
Select Field as "Level".
-
Under Conditions, add a condition as Level is Tier 4.
-
Under Actions, add an action as Mandate Fields Priority, Impact.
-
Save the Rule.
Scenario:
-
If Priority and Impact are High and Technician is not allocated/available, then stop the form (request) submission and mandate the Technician field.
-
Applicable to all users and for edit request operation.
Steps:
-
Create a new rule under "On Form Submit" event (say, "high priority and high impact check technician")
-
Set as "Applies to All Users".
-
Set Rule Execution as "On Create/Edit".
-
Under Conditions, add the conditions: Priority is High, Impact is High and Technician is Not Specified.
-
Under Actions, open the script editor pop up by clicking the "Write custom script" link.
-
Write a script to mandate the Technician field and stop the form submission, as shown in the below image.
- Save the script and the rule.