- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2014 11:35 AM
I've been searching the community and the wiki and I have seen several ways that people have said they've done this, but none of them are working for me.
Here is my scenario:
The request is for the review of an assignment group and will be sent to the assignment group manager for fulfillment. It is to be filled out by the ITSM management team.
A reference field is filled in with the Assignment Group name by the requester.
A client script populates the Assignment Group Description field and the Assignment Group Manager field. Easy as pie.
There is a field for the members of the assignment group, and one more for the CI's associated with this assignment group. I haven't gotten to the CI field yet, but I think it will work similarly to the assignment group members.
I know which table holds the membership information (sys_user_grmember), and I know that a script will provide the information, but I've seen a business rule, a script include, a client script and I think a UI policy floating around the community.
And none of them work for me. I'm not sure which one if them is the correct place to script this. And I'm not sure if the field on the form should be a reference field, or a wide single line text, or not even a field, just a message that shows up. Or a list collector...
Looking for clarity and assistance on this one... Thanks in advance.
Suzanne
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2014 12:25 PM
and yes , there was a typo
script :
function assignmentGroupUsers()
{
var group = current.variables.assignment_group;
var user_array = [];
var getMembers = new GlideRecord('sys_user_grmember');
getMembers.addQuery('group',group);
getMembers.query();
while(getMembers.next())
{
user_array.push(getMembers.getValue('user'));
}
return 'sys_idIN' + user_array.toString();
}
i have set up a demo for you ...
goto
https://demo002.service-now.com/login.do
username : admin
password : admin
catalog to check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2014 01:10 PM
The demo was really helpful in letting me see how the Script Include was named and how the variables were set. Thanks again for taking the time to help me with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2014 02:42 PM
Kalai,
I'm now trying to modify the script include to look for all the CI's that have that assignment group as the support group. And in my inimitable fashion I think I mucked it up. Here's what I changed the script include to read. The variable "rev_existing" contains the assignment group value.
It's not working... Any suggestions?
function assignmentGroupCI()
{
var group = current.variables.rev_existing;
var ci_array = [];
var getCI = new GlideRecord('cmdb_ci');
getCI.addQuery('group',group);
getCI.query();
while(getCI.next())
{
ci_array.push(getCI.getValue('name'));
}
return 'sys_idIN' + ci_array.toString();
}
Thanks!
Suzanne

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2014 07:50 PM
Not sure if i understand this correctly but you want the sys id's of all the CI's that has a particular group as support group ?
if that is the case , try this ... Haven't tested it though... Let me know the results...
function assignmentGroupCI()
{
var group = current.variables.rev_existing;
var ci_array = [];
var getCI = new GlideRecord('cmdb_ci');
getCI.addQuery('support_group',group);
getCI.query();
while(getCI.next())
{
ci_array.push(getCI.getValue('sys_id'));
}
return 'sys_idIN' + ci_array.toString();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2014 02:45 PM
Hi Kalai, Sorry for the delayed response here. I'm not looking for the sys_id's of the CI's, but in the same way as we gathered the names of the members of the assignment group, I'd like to get the names of the CI's that have this assignment group as their assigned support group. I'm not sure if it will work the same way (actually I know it doesn't because the script I shared doesn't work).
Let me know if that clarifies... Thanks!
Suzanne

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2014 06:26 PM
tried the script above? it should do exactly the same what you are expecting ... it will give the CI's, whose support group is the given group in the input... try that once and let me know the results...