- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 06:16 AM
Hi,
I'm trying to set up a rule that if a user selects a specific category the priority will be set at a specific value. E.g Subcategory = Phishing Email, Priority = 2 - High
I think what I need to do is create a custom data lookup table & definition record and then a client script
Am I going about this the right way, or am I wrong and there's a better way to do this?
Thanks
Shona
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 07:59 AM
Try this client script:
Table: Incident
Type: OnChange
Field Name: subcategory
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'antivirus') {
g_form.setValue('impact', 1);
g_form.setValue('urgency', 1);
}
}
I just tested this on my dev instance, and it works as expected (sets priority to Critical). Obviously, you would need to modify for your proper subcategory value and impact/urgency values.
Hope that helps!
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 06:27 AM
You could have an onChange client script that says:
onChange subcategory
if(newValue == 'Phishing Email'){
g_form.setValue('priority', 2);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 07:00 AM
hey,
you can create a custom lookup table if you need
hope the following thread helps:
Data Lookup and Record Matching Support - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 07:17 AM
Hey Namrata,
That was the avenue I was originally going down, but it seemed quite convoluted for what I was trying to do (also I'm unable to add any setter field definitions - which is weird)
Mike, I'm trying out your suggestion but not getting anywhere fast so will persevere longer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 07:30 AM
Are you utilizing (as in, you haven't disabled the functionality) the out-of-box data lookup on the priority field?
I'm wondering if using a client script to change the priority field value will not make a difference given the priority field is read only and the value is driven by the impact/urgency field values. Maybe try changing the impact/urgency fields instead, which will in turn drive the priority field value.