Range of Numbers needs to be populated based on selection of two fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 12:56 AM
Hi All,
I have a requirement that when state is marked as resolved in agent workspace 3 additional fields needs to be visible. These are the fields location, firewall name, reference number. Location field has been mapped as a reference field with location table and firewall name and reference number is a choice field.
My requirement is if state is marked as resolved these fields needs to be populated based on the selection of location field, the firewall name and reference number needs to be visible in the field.
For eg: If location is selected as A, firewall name should be visible associated with location A and reference number should be visible from 1 to 999 in a sequence mode.(1,2, 3,... etc)
If location is selected as B, firewall name only associated with B needs to visible ( Firewall Name Associated with A should not be visible) and reference number should be 1000 to 2000 in a sequence mode (1000, 1001, 1002)etc.
If anyone worked on such cases, please help me on this along with steps.
Thanks in advance.
Ajith Pillai

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 01:15 AM
@Ajith A Pillai You can easily achieve this implementation using Reference qualifier on firewall field and onChange script on the firewall field. Please research about Reference Qualifier and Onchange client script and I am sure you will be able to achive the desired implementation. If not share the name of your fields and a snapshot of the form, I will write the script for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 05:29 AM
Hi Sandeep,
Thanks for the reply.
I have 3 three fields these are populating through some UI Policies.
These are the custom fields which is created on sc_task table
Location, Firewall Name and Reference Number(Need to be populate as sequential based on the selection of firewall name). Can you please help me on the scripting part.
Regards
Ajith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 01:27 AM
To achieve this, you can use a combination of Client Scripts and Business Rules in ServiceNow. Here are the steps:
1. Create a Client Script:
- Navigate to System Definition > Client Scripts.
- Click on New to create a new client script.
- Set the table to the table you are working on.
- Set the Type to "onChange".
- Set the Field name to "state".
- In the script, check if the state is "Resolved". If it is, make the fields "location", "firewall name", and "reference number" visible.
2. Create a Business Rule:
- Navigate to System Definition > Business Rules.
- Click on New to create a new business rule.
- Set the table to the table you are working on.
- Set the When to run to "before".
- Set the Inserts, Updates checkbox.
- In the script, check if the state is "Resolved". If it is, based on the location field, set the appropriate values for "firewall name" and "reference number".
3. Create a Reference Qualifier for the "firewall name" field:
- Navigate to the table where the "firewall name" field is located.
- Open the dictionary entry for the "firewall name" field.
- In the "Reference Specification" section, set the "Reference Qual" field to a script that returns the sys_ids of the firewall names associated with the selected location.
4. Create a Dynamic Choice List for the "reference number" field:
- Navigate to the table where the "reference number" field is located.
- Open the dictionary entry for the "reference number" field.
- In the "Choice" section, set the "Choice" field to a script that returns the sequence of numbers based on the selected location.
Please note that the exact scripts will depend on your specific table structure and data.
nowKB.com
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER