- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:12 AM - edited ‎07-05-2024 04:54 AM
Hello,
I have a requirement to allow a group to be added to the watch list, the intended usage at the moment will be using groups containing only portal / non-itil users.
This is to allow additional comments requesting more info to be sent to a group of users without having to add each user as a watcher, and allows the whole group to view the request in the portal.
I have added the field "group_list" to the SCTASK, REQ & RITM forms to allow interested groups to be added and I think my next step is to then create a business rule to copy the group_list updates from SCTASK to REQ since our users view REQ in the portal. We do not want the engineer to have to leave the sctask and manually update the group_list on the REQ.
I currently have a working after BR set up on sc_req_item table that copies any changes to the watch list :
(function executeRule(current, previous /*null when async*/) {
// Add your code here
//get the gliderecord for the parent request
var req = new GlideRecord('sc_request');
if (req.get(current.request)) {
req.watch_list = req.watch_list + ',' + current.watch_list.toString();
req.update();
}
})(current, previous);
Please could someone advise how I can replicate this BR to copy the group list to REQ?
I'm not quite sure where to start, I did try replacing all mentions of req.watch_list with group_list which, as expected, did not work, any help would be most appreciated.
Thank you!
Update:
Thank you Dnyaneshwaree for the assistance, this after BR is working now that I added the requested_item.group_list to the SCTASK form (I had added only group list previously which was my mistake!) Now we can add groups in the same way as users to watch lists and they can view the REQs in the portal and have also been added to our notifications.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
//get the gliderecord for the parent request
var req = new GlideRecord('sc_request');
if (req.get(current.request)) {
req.group_list = req.group_list + ',' + current.group_list.toString();
req.update();
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:28 AM
Hello @Imogen Zakar ,
Replace the watch_list field to your "group_list" field and check it ones.
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:28 AM
Hello @Imogen Zakar ,
Replace the watch_list field to your "group_list" field and check it ones.
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:37 AM
Hello,
Thanks for the suggestion, I have tried that and unfortunately it does not work.
I have tried both like this:
....
if (req.get(current.request)) {
req.group_list = req.group_list + ',' + current.group_list.toString();
and:
.....
if (req.get(current.request)) {
group_list = group_list + ',' + current.group_list.toString();
Any suggestions would be great, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:48 AM
I realised my error! I had added just the group_list to the sctask form rather than the requested_item.group_list, now with your suggestion the BR is working.
Thanks for your help 🙂