Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

IP Validation : Variable Regex vs Client Script

sayalishinde
Kilo Explorer

Hello Community,

 

I recently worked on IP address validation for monitoring catalog forms. Instead of using a Client Script, I found that Variable Validation Regex is a better low-code option. It reduces custom scripting, is easier to maintain, and aligns with ServiceNow’s no-code/low-code approach.

 

1- Create the regex record

Navigation - All - Service catalog - catalog variables - variable validation regex - new
Name - for example "IP address"
Validation message - for example "Enter valid IP address"
Active - True

Regular Expression - add your regex value

Regex Flag - None
Save

2- Link regex to the variable

Navigation - All - Service catalog - catalog Definations - Maintain Item - Open your record

Open Variable - Open your existing variable for IP address
Name - IP address

Type - Single line text(must for getting validation)

Related tab - Type Specification - Validation(or Regex) - Set your "variable validation regex" record i.e "IP address"

 

Benefits:
Instead of creating a Client Script, writing custom validation code, and configuring separate error messages, you can simply use Variable Validation Regex. This reduces custom scripting and makes the validation easier to configure and maintain.



Please mark this post as Helpful if you found it useful.

 

0 REPLIES 0