Client Script that Search if a field contains a certain string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2012 12:06 AM
Hi,
I am making an onSubmit Script that will warn the submitter if the ticket contains the word "child".
Below is my script.. But it doesn't work.. Please help which operator/ script should I use that will search if there is a "child" on the short description. Thanks,
function onSubmit() {
//will prompt the submitter if ticket has a Child
var child = short_description.indexOf("[child]") > -1;
if ((child == true ) && (priority == 1)){
confirm ('Warning: You seem to be classifying a child ticket as a Prio1. That is probably not correct. Please click Cancel to correct or OK to proceed (not advised)');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2012 04:14 AM
function onSubmit() {
//will prompt the submitter if ticket has a Child
var child = g_form.getValue('short_description').indexOf("child") > -1;
var priority = g_form.getValue('priority');
if ((child == true ) && (priority == 1)){
confirm ('Warning: You seem to be classifying a child ticket as a Prio1. That is probably not correct. Please click Cancel to correct or OK to proceed (not advised)');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2012 10:39 PM
It now works! My apologize as I am really new to scripting.. Thanks Mark!