- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2014 09:01 PM
Hi - looking for some assistance.
I believe this is an easy issue which I just cannot get my text correct
I have my assignment group Reference Specification as:
- Use reference qualifier: Advanced
- Reference qual: javascript:new BackfillAssignmentGroup().BackfillAssignmentGroup()
The above means that if an "Assigned To:" person is entered and the ITIL user wants to see what Assignment groups they are a member of they get the correct list.
What I want to do is also have the Assignment Group limited to just those groups that start with "IT"
If I do a simple qualifier I get the code "nameSTARTSWITHIT^EQ"
However I cannot combine them into one string to both work
What I have tried (amongst other options):
- javascript:'new BackfillAssignmentGroup().BackfillAssignmentGroup()^'+nameSTARTSWITHIT^EQ()
- javascript:'new BackfillAssignmentGroup().BackfillAssignmentGroup()^'^nameSTARTSWITHIT^EQ()
Any ideas would be appreciated
cheers
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2014 02:24 PM
Sure. Try this:
javascript: var refQual = ''; if (current.assigned_to != '') {var usr = gs.getUser(); usr = usr.getUserByID(current.assigned_to); var grp = usr.getMyGroups().toArray(); refQual = 'sys_idIN' + grp.join()} refQual += '^nameSTARTSWITHit'; refQual;
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2014 09:46 PM
Hi Andrew,
You can add this condition in the BackfillAssignmentGroup() function as an encoded query
object.addEncodedQuery('group.nameSTARTSWITHIT');
I guessm this will resolve your query.
Ram--

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2014 11:09 PM
Reference Qualifer : javascript: BackfillAssignmentGroup(current.assigned_to)
Script Include:
Name : BackfillAssignmentGroup
Script :
function BackfillAssignmentGroup(userID)
{
if(userID == '')
{
return;
}
var groups = [];
var grp = new GlideRecord('sys_user_grmember');
grp.addEncodedQuery('user='+userID+'^group.nameSTARTSWITHIT');
grp.query();
while(grp.next()){
groups.push(grp.group.sys_id.toString());
}
return 'sys_idIN'+groups.toString();
}
Note : Returning all groups if the assigned to is blank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2014 06:06 PM
Thankyou both for the response - I know what I am going to be playing with over the Christmas period - cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2014 06:44 PM
Hi - I have been playing around with this and still doesn't work for me.
If I do the reference qualifier:
- javascript:new BackfillAssignmentGroup().BackfillAssignmentGroup()
- It correctly shows groups that the assigned to is a member of
If I do the reference qualifier:
- active=true^nameSTARTSWITHIT
- It correctly only shows groups starting with IT
However I feel that I should be able to combine these as one Reference Qualifier that will only show groups starting with IT and still retain the BackFill statement
I have tried Encoded Query Strings - ServiceNow Wiki (sections 2.4) and also Reference Qualifiers - ServiceNow Wiki
with no luck.
Am I being naïve in thinking that these could be combined in one piece of code?
Cheers