- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 02:13 AM
1.Test is a single line text variable. for example if i enter any ip range value(0.1.1.1 -25.5.5.5). its check the range and validate it.
2.if i enter incorrect(fsdfasf-11.1.1.1) ,(300.299.1.0) populate alert msg(please give valid ip range)
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2021 12:11 AM
I have written client script to validate Ip range using ip address(IPV4) regex.
I divided two ip address as string separated by "-";
stored srt1 and srt2 to values in var a (used replace function to remove dots make it as a single string (a))
nd var b (used replace function to remove dots make it as a single string (b))
use if condition to compare first ip address (a) is not greater than or equal second ip address(b)
ex :if(a>=b)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 02:21 AM
Hi,
Please check the script in the below thread,
if it is catalog, take the regex and place it in regex validation in type specifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 02:33 AM
1. Go to question_regex table and create new regular expression. I am assuming your range is (0.1.1.1 -25.5.5.5).
Use below regular expression:
^(0(\.1){2}\.([1-9]|[1-9]\d|[12]\d\d)|0\.1\.([2-9]|[1-9]\d|[12]\d\d)\.([1-9]?\d|[12]\d\d)|0\.([2-9]|[1-9]\d|[12]\d\d)(\.([1-9]?\d|[12]\d\d)){2}|25(\.5){2}\.[0-5]|25\.5\.[0-4]\.([1-9]?\d|[12]\d\d)|25\.[0-4](\.([1-9]?\d|[12]\d\d)){2}|([1-9]|1\d|2[0-4])(\.([1-9]?\d|[12]\d\d)){3})$
Set validation message as you like.
2. Then go to your variable. In "type specifications" tab > Validation Regex > Select the one you created.
Check and let me know if it works for you.
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 04:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 04:33 AM
Hi,
Do you want to validate the IP address range and not the IP address?