- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 11:47 PM
Hello Community !
I need create one new notification when the needs attentions is true on the sc_task
For this
Trigger condition: 1. state changes from Pending to Work in progress
2.Additional comments updated by customer/ not assigned to
3.Catalog type is SSR
Should I need to create a multiple events for each one of this three conditions, if so then how to implement that.
If not how to achieve this.
Looking forward for the working solution
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 01:09 AM
Don't use Event, let notification get trigger based on updated checkbox on sc_task table
for checking this -> 2.Additional comments updated by customer/ not assigned to
You can use advanced notification condition and script
Something like this and enhance it further
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 03:09 AM
then use toString() to compare and also use gs.getUserName() to get user ID at line 10
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
gs.info('userID7');
var comments = '';
var userId = gs.getUserName(); // Get the logged-in user ID
gs.info('userID9' + userId);
var requestorId = current.request_item.requested_for.user_name.toString();
gs.info('userID14' + requestorId);
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', current.sys_id);
gr.addQuery('element', 'comments');
gr.orderByDesc('sys_created_by');
gr.query();
gs.info('userID14' + requestorId);
gs.info('created by' + gr.sys_created_by);
if (gr.next()) {
gs.info('userID25', +comments);
if (gr.sys_created_by.toString() == userId || gr.sys_created_by.toString() == requestorId) {
gs.info('userID23' + comments);
comments += gr.value + '\n';
}
}
gs.info("userID32" + comments);
template.print('The task ' + current.number + ' has been updated by the customer with below comments ' + comments + '\n');
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 02:55 AM
did you check who is the gr.sys_created_by
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 03:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 03:09 AM
then use toString() to compare and also use gs.getUserName() to get user ID at line 10
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
gs.info('userID7');
var comments = '';
var userId = gs.getUserName(); // Get the logged-in user ID
gs.info('userID9' + userId);
var requestorId = current.request_item.requested_for.user_name.toString();
gs.info('userID14' + requestorId);
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', current.sys_id);
gr.addQuery('element', 'comments');
gr.orderByDesc('sys_created_by');
gr.query();
gs.info('userID14' + requestorId);
gs.info('created by' + gr.sys_created_by);
if (gr.next()) {
gs.info('userID25', +comments);
if (gr.sys_created_by.toString() == userId || gr.sys_created_by.toString() == requestorId) {
gs.info('userID23' + comments);
comments += gr.value + '\n';
}
}
gs.info("userID32" + comments);
template.print('The task ' + current.number + ' has been updated by the customer with below comments ' + comments + '\n');
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 06:43 AM
Hello @Ankur Bawiskar
It is working now I have made few changes
Thanks for your response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 06:51 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader