Email/ID (Single Line Text Box) Confirmation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 10:49 AM
Good Morning Team,
Something I am working on requires me to add a text box for the ID Number (single line text) and then asks for another text box to confirm the ID Number is correct. Is there any UI policy or such that will have the system check if the two variable inputs are the same? How should I go about doing this?
Thank you,
VD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 01:04 AM
Can you please let us know what do you mean by Client Script template ? @Siddhesh Gawade has already provided an explanation on the same in his earlier reply.
Request you to let us know the exact requirement so that we will be able to help you further.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 01:33 AM
Yes, you can achieve this by creating a UI Policy or Client Script in ServiceNow. Here's a step-by-step guide on how you can do this:
1. **Create a UI Policy:**
- Navigate to System UI > UI Policies.
- Click on New to create a new UI Policy.
- Fill in the necessary details like Name, Table (where you want this policy to apply).
- In the UI Policy Actions related list, click on New.
- Set the Type to Script and write a script to compare the two fields.
2. **Create a Client Script:**
- Navigate to System Definition > Client Scripts.
- Click on New to create a new Client Script.
- Fill in the necessary details like Name, Table (where you want this script to apply).
- In the Script field, write a script to compare the two fields.
Here's a sample script you can use:
javascript
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var idNumber = g_form.getValue('id_number');
var confirmIdNumber = g_form.getValue('confirm_id_number');
if (idNumber != confirmIdNumber) {
g_form.addErrorMessage('ID Numbers do not match');
g_form.clearValue('confirm_id_number');
}
}
This script will compare the values of the 'id_number' and 'confirm_id_number' fields. If they do not match, it will display an error message and clear the 'confirm_id_number' field.
Remember to replace 'id_number' and 'confirm_id_number' with the actual names of your fields.
Please note that Client Scripts run on the client-side (browser), while UI Policies run on the server-side. Depending on your requirements, you may choose to use either one.
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