- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 09:12 AM
Hello!
Under System Notification -> Email -> Notifications I'm looking at the OOTB Incident Resolved notification.
And its default condition is to send when Incident State changes to Resolved.
I'd like to add an and condition that checks to see if the incident has any Requests (sc_request) related to it. If it has a request, do not send notification. If it does not have a request, send the notification.
From what I can tell, when I click create request within the incident in the hamburger menu, it sets the incident as parent on the request. Not on the incident.
I unfortunately do not know at this time how to make an advance condition with scripting. Also when showing related fields, I did not see anything related to the request table.
Any help would be appreciated!
Thanks!
Dom
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 02:02 PM
Strange, well some other OOB ones don't include the answer variable you could try this instead:
var g = new GlideRecord('sc_request');
g.addQuery('parent', current.sys_id);
g.query();
if(g.hasNext()) {
false;
} else {
true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 01:32 PM
It didn't create the notification when the incident had a request, which is what was expected. However it didn't create a notification when the incident didn't have a request - still want it to be sent in this second case. I'll see if I can play around with it and continue to test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 02:02 PM
Strange, well some other OOB ones don't include the answer variable you could try this instead:
var g = new GlideRecord('sc_request');
g.addQuery('parent', current.sys_id);
g.query();
if(g.hasNext()) {
false;
} else {
true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2020 10:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 02:19 PM
Try this ....
var gr = new GlideRecord("sc_request");
gr.addQuery('parent', current.sys_id);
gr.addActiveQuery();
gr.query();
answer = gr.getRowCount()>0 ? false:true;