Time validation regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 05:30 AM
HelIo,
I need to create a field in the service catalog item as "time" type,
so I tried to add regular expressions at variable Validation Regex, but it didn't work.
I used : "^([AM]{2}|[DP]{2}|[DTO]{3}|[GBL TECH]{8}|[MF]{2}|[NIS]{3}|[US TECH]{7})([0-9]{4})?$"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2024 10:35 AM
Hello,
Apply the following to "variable attributes" in the field with the variable type "Duration": max_unit=minutes
This will format the seconds to the minute when generating the request.
Another way is to apply a regex to the field defined as "single line text". The valid regex is "00:00:00".
Regex: ^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$
Documentation
Variable Attributes: https://docs.servicenow.com/en-US/bundle/washingtondc-servicenow-platform/page/product/service-catal...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2024 10:45 AM
Hello,
Apply the following to "variable attributes" in the field with the variable type "Duration": max_unit=minutes
Another way is to apply a regex to the field defined as "single line text". The regex validates the format "00:00:00".
Regex: ^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$
Documentation
Variable Attributes: https://docs.servicenow.com/en-US/bundle/washingtondc-servicenow-platform/page/product/service-catal...