- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 09:02 AM
Hi All,
We have a scenario where some of our app owners are going to need to be aware of incidents. They don't work the incidents so we don't want to assign them and consume a license. We do need to give them access to view the incidents that come in about their area though.
When I select a configuration item, the Owner and Support group are also shown on my form. Based on the Configuration Item selected on the incident, I'd like to add the Owner and Support Group members to the watch list.
Can anyone help me with a script to add a group's members to the watchlist of an incident on insert or maybe when a Boolean field is set to true?
Thanks,
Carl
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 09:25 AM
You could create a business rule that adds the owner and group members to the watch list when the incident is created and the values are present on the CI. Haven't tested this specifically, but something similar has worked for me.
Create new business rule: Add CI Owner to watch list
Table: Incident [incident]
When: before
Insert: True
Script:
//Add opened by to the watch list on the requested item if different from the requested for
addToWatchList();
function addToWatchList() {
//get CI owner and ad to watch list
current.watch_list += current.cmdb_ci.owner;
//get group members
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group',current.cmdb_ci.support_group);
gr.query();
while(gr.next())
{
var user =(','+ gr.user);
current.watch_list += user;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 02:09 PM