Error creating a notification.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
40m ago
Hello everyone,
Currently in our instance there are some items of multi SC_Task type, which I have seen are evaluated at the notification level through this code:
var reqItemSysId = current.request_item.sys_id;
var variables = {};
var itemOptions = new GlideRecord('sc_item_option_mtom');
itemOptions.addQuery('request_item', reqItemSysId);
itemOptions.query();
while (itemOptions.next()) {
variables[itemOptions.sc_item_option.item_option_new.name] = itemOptions.sc_item_option.value;
}
if (variables['multitask'] == 'true'){
answer = true;
}else{
answer = false;
}
The fact is that I have to create a notification that is sent when an "additional comment" is added to the parent RITM and it is sent to all the assigned groups (which are usually several and different from those of the parent RITM) to each of the "child SC_Tasks". For this I have created the notification, a BR and an event that I leave here, but I can't get it to work, any ideas.
Notification:
Event:
BR:
(function executeRule(current, previous) {
if (current.additional_comments == previous.additional_comments)
return;
var vars = {};
var opt = new GlideRecord('sc_item_option_mtom');
opt.addQuery('request_item', current.sys_id);
opt.query();
while (opt.next()) {
vars[opt.sc_item_option.item_option_new.name] = opt[opt.sc_item_option.value];
}
if (String(vars['multitask']).toLowerCase() !== 'true')
return;
var child = new GlideRecord('sc_task');
child.addQuery('request_item', current.sys_id);
child.query();
while (child.next()) {
if (child.assignment_group) {
gs.eventQueue(
'atc.ritm.multitask.comment_added',
child,
current.additional_comments,
''
);
}
}
})(current, previous);
Thank you very much in advance and greetings.
0 REPLIES 0
