client script for category and subcategory assignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2010 11:33 PM
Right now in our service-now instance, if you create an incident and choose a category called 'Accounts' , the inc get assigned to the group 'Desktop'
automatically throught.
I am writing a client script to assign the inc to the group 'DBA' if the category is 'Accounts' and the subcategory is 'Oracle' .
My script is partially working but after my script assign the inc to 'DBA' , the assigned_to field doesn't allow dropdown suggestion anymore.
Can someone help?
Here is my script
Type: OnChange
Table: Incident
Field Name: Subcategory
function onChange(control, oldValue, newValue, isLoading)
{
//If the page isn't loading
if (!isLoading)
{
//If the new value isn't blank
if(newValue != '')
{
//Type appropriate comment here, and begin script below
var cat_field = document.getElementById('incident.category');
var cval = g_form.getValue('category');
if ( cval == "Accounts & Passwords" )
{
if ( newValue == "Oracle" )
{
g_form.setValue('assignment_group', 'DBA');
}
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2010 03:36 AM
I am not very good at scripting but you could always do this is an assignment rule. No scripting involved and easy to set up.
to view more on assignment rules, check out the wiki http://wiki.service-now.com/index.php?title=Defining_Assignment_Rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2010 05:55 PM
Steve,
Assignment rule will not work for this. The tool assigns it to the right group but the list of assignee for that group is just bank. I already tried that route.
I think Mark is right on the money. I have to use the sys_id rather than the name of the group but I just don't know how to do that.
After the script assign it to DBA and I manually remove the DBA from the entry field and type it again , then I can list a list of assignee once I click on the zoom icon.
Mark, will you be able to provide additional help?
Thanks
Alain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2010 05:58 PM
By the way , we are already using the "AJAX Assignment (Category)" and "AJAX Assignment (subCategory)" client scripts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2010 01:31 PM
If you're using the ajax assignment scripts then no other script should be necessary. Do you also have an assignment rule defined? Do you also have records populated in an assignment lookup table?
The ajax scripts go and run your assignment rules, the assignment rule needs to have a script to query your lookup table, the lookup table should contain the group/user combination to be populated if a particular cat/subcat is chosen.
If you have those pieces in place then you shouldn't have to worry about any other script.