I wanna create variable in record producer. That variable should have values only in between 500 to 5000. by default it should hold 5000.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 10:38 PM
I wanna create variable in record producer. That variable should have values only in between 500 to 5000. by default it should hold 5000.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 11:01 PM
You can create single line text field and write onchange client script to check if enterd value is between 500 to 5000. if not then show error and clear field.
You can define default value as shown below
Regards,
Abhijit
Community Rising Star 2022
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 11:21 PM
Hello Sachin,
You can find solution below
1. Set the regex validation for your variable
2. Set default Value to 5000
3.Write onChange Client script to validate number is in range
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 11:31 PM
What did you start with and where are you stuck?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 12:34 AM
Hi
Create a regular expression, see the below image for reference.
Below is the explanation of the regular expression.
// ^[5-9]+\d{2}|^[1-4]+\d{3}|^[5]+0+0+0+
// Here we are targeting 500-999
// ^[5-9]+ means number starts with at least one (+ indicates at least one) of 5, 6, 7, 8, 9
// \d{2} means after that it will contain 2-digits, which could be any from 0-9
// | it is like an OR, which means if above not found search for other expression
// Here we are targeting 1000-4999
// ^[1-4]+means number starts with at least one (+ indicates at least one) of 1, 2, 3, 4
// \d{3} means after that it will contain 3-digits, which could be any from 0-9
// | it is like an OR, which means if above not found search for other expression
// Here we are targeting 5000 only
// ^[5]+means number starts with at least one (+ indicates at least one) 5
// 0+ means contains at least one 0
// 0+ means contains at least one 0
// 0+ means contains at least one 0
Then create a variable and select the regex which you created above. See the below image for reference.
Portal Output
Native UI Output
To define default value, specify it as 5000 in the default value tab/section of the variable.
Hopefully, this will resolve your query.