variable item validation for email in catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 06:28 AM
How can i make simple validaition for variable in maintain item ?
I need to validate email. it should contain "@" sign.
Regards,
Patrycja

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 06:30 AM
I believe there is a variable type of email that will do this for you:
Types of service catalog variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 06:35 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 06:38 AM
What release are you on?
If you don't have that option available, you'll need to use a catalog client script to validate the variable. Here's a post that has a sample you can probably use:
Email address input validation service catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2018 08:05 AM
I was looking to do the same thing in the Service Portal. I am on Jakarta, which does have the Email variable. But unfortunately, that will not work for me. If you click on the link in Brad's post, and go to the Email variable, it states right there:
Note: Variable validation is not supported in Service Portal.
So, I took a look at the other link referenced here, and was able to manipulate it to do what I need, and validate my variable in the Service Portal, using a Catalog Client Script.
Here is the code that worked for me:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
g_form.hideFieldMsg('group_contact_email_address');
if (!isLoading && newValue !='') {
var inbox = g_form.getValue('group_contact_email_address');
var validRegExp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
if (inbox.search(validRegExp) == -1){
alert("Invalid Email Address!");
g_form.setValue('group_contact_email_address','');
}
}
}