Template - setting a field to a user specific group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 03:03 AM
We're currently trialling an Incident template in ServiceNow and we want to set it so that it assigns the incident to a particular Assignment Group dependent on the person who is logging the call. My first thought would have been to use 'javascript:gs.getMyGroups();' in the Assignment group field as below but the obvious problem here is that it won't work for users with more than one group (if they have more than one group it returns the field blank).
Does anyone know if there's a way to filter this further so that it only picks up the user's primary Assignment group? At this point, their primary Assignment group is unmarked and doesn't show different to any other groups. However, all primary Assignment Groups in this area start with the letters 'S.IT - ' so if there's a way to filter the groups based on name that can be used in a template that could work.
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 03:12 AM
Can't you make use of assignment rule ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 03:16 AM
you could create a scriptInclude called getUsersPrimaryGroup()
then call that in the template field and return of the sys_id of the group you decide upon.
javascript:getUsersPrimaryGroup()
script include function would then take the current user gs.getUser() and work out how to find their primary group, so find the groups they are a member of by querying sys_user_grmember to find their groups, then from that list, work out how you want to decide which group sys_id to return.
we actually just have a 'primary assignment group' reference field on the users record to make it easier but you could script it to run through your naming convention if you like.
Marc