notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 08:13 PM
i have a notification running on issue table that whenever a new issue is created(when- record inserted or updated). it triggers notification for control owner.
now modification required that when control name is " CM-99 technical control". notification should not trigger for this specific control. i had applied everything in conditions still whenever a new issue is created notification is still triggering.
i also used this script in advance condition as well
please assist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 09:57 PM
I don't know the details so for reference
var ab = new GlideRecord('sn_grc_issue');
ab.addQuery('sys_id', current.sys_id); // Corrected the field to sys_id
ab.addQuery('item.name', "CM-99 Technical Control"); // Ensure name matches exactly
ab.query();
if (ab.next()) {
answer = false; // Prevents the notification from triggering
} else {
answer = true; // Allows the notification to trigger
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 09:58 PM
Hi,
Since you are using string as condition, check if there is any extra space or type mismatch.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 11:30 PM
Is there really a space character at the beginning of the Group name? I'm assuming it's a Group, I do not have the GRC app installed. Having leading or trailing spaces is a horrible idea.
I'm assuming the condition is on the Notification table itself. Can you show us a screenshot of how the "Conditions" field was configured previously. That would be the best way to do it.
Also, there are a couple issues with your:
1. as @HIROSHI SATOH shows in his script, you are missing quotes around the table name
2. why would a "number" match a "sys_id"?
3. you describe the control name as " CM-99 technical control" but the script has " CM-99 Technical Control Automated Compliance". Which is it? Or do you mean starts with or contains " CM-99 Technical Control"?
And it can be simplified to something like this:
answer = current.item.name.toString() == " CM-99 Technical Control Automated Compliance";
I'm assuming "item.name" is the proper field you want to look at? But you do not need to search for the record: "current" is the record that triggered the Notification. However, it's not a great idea to hard-code a name into the script. You should use a System Property for that in case the name changes. And that's why it makes more sense to get the Conditions field working.