
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎03-27-2019 08:06 AM
In Madrid there is a new functionality that will greatly reduce time and effort that we are spending on adding validations to the variables on the catalog form. The new feature is Variable Validation Regex.
In several cases we will be doing the same validations for some variables in different catalog items using client scripts ,it will obviously take some time to implement the validations to each variables even though it is already existing.
In long term it will cause maintainability issues because the number of scripts will grow with time while adding additional functionalities to form.
Using this new feature we can avoid the above cases. Now let see how to use this feature :
Create Variable Validation Regex:
- Navigate to Service Catalog > Catalog Variables > Variable Validation Regex > Click New.
- Give a name for the record.
- In Regular Expression enter the sequence of characters that define the format of the variable value.
- In Validation message - enter the message that needs to be appears when the validation fails.
- Submit the form.
Using the created Variable Validation Regex in catalog form:
1.Navigate to Service Catalog > open the item in which you need to add this validation > open the variable dictionary.
2.Configure form layout to add the Validation Regex field.
3. Select the Validation Regex created previously and save.
Testing it in catalog form:
Test your variable in the form, If you enter an invalid input it will throw the error-out the variable and shows error message, and also prevents form submission without reentering the correct input for that variable.
We can use a single variable validation regex in any number of variables having similar validations. It helps to reduce code,effort and saves time.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Updates:
Known issues:
1.
"If there's a mandatory variable validated by a regex, it's still possible to submit the catalog item, however, it'll get stuck on submit. If the variable isn't mandatory, it'll be validated correctly and the item can't be submitted"
Fix: no fix available (PRB1355430)
Workarround:
Workarround for above issue(by Mark Gaghavan)
2. Unable to submit form without clearing the error message( Madrid)
Right now, if you input an invalid entry and then clear the variable, the error remains and you are forced to enter a valid entry to clear the error even if the field is not mandatory. You cannot submit unless the validation error is cleared.
Fix: Issue fixed in NewYork
If this article helped you , please bookmark it or mark it as helpful.
-Satheesh
- 4,998 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for sharing the info.
I just wish the validation would clear the previous error if the user clears the contents of the variable. Right now, if you input an invalid entry and then clear the variable, the error remains and you are forced to enter a valid entry to clear the error even if the field is not mandatory. You cannot submit unless the validation error is cleared. So close 🙂
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Satheesh,
Thanks for this.
This works perfectly when I am logged in as an admin or itil user. But for ess users, the validation does not seem to do anything. Any idea why that might be?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi mdash,
I verified it for a no role user and it is working as expected. Can you verify the regex is configured properly.
it should work for all users.
Satheesh

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Jim,
The above issue is fixed in NewYork!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks Satheesh.
When I double checked, I found that my instance had external role plugin enabled. So there is a system property which lets such REST Calls (the Validation regex being one of them) run only for internal roles.
I deactivated that property and it works now!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi SatheeshKumar,
How about Translation for the validation messages? translation is done as part of Madrid?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Validation message is translated OOB similar to other catalog variables.
The translation values are picked based on users current language.
Steps to add translated value :(example lang : german)
Change your language to German
Navigate to the variable validation regex and enter your message in german in Validation message field.
Save the record.
When you change back to English ist shouldn't have affected the English version but now the Validation message should be translated in German.
In catalog item the message is displayed dynamically based on current language.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you SatheeshKumar.