Notification on sc_task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 12:08 AM
Hello,
I have a notification on sc_task table where I am trying to add a condition, when the request item is on specific stage, notification should trigger.
So far I have included the condition with the AND statements provided:
Request item.Stage contains 'Stage Name'
but notification doesn't seem to triggered.
I have also tried including it as an advanced condition, with following script:
var answer = false;
condition();
function condition(){
var gr = new GlideRecord('sc_req_item');
gr.addQuery("sys_id",current.request_item);
gr.query();
if(gr.next()){
if(gr.stage == 'Stage Name''){
answer = true;
}
}
return answer;
}
I have used a similar script on other notification and they work fine. The only difference is that working notifications are calling on approvals table and above calls on the tasks.
I am not great at scripting, and I get the sense the addQuery might be wrong. Please help.
Thank you so much in advance.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 12:45 AM
Hi,
if(current.request_item.stage == 'value of your stage choice used in workflow')
answer = true;
else
answer = false;
Writing this script in the advanced script field of your notification on sc_task should work.
I checked it and its working fine.
Please check your stage value used.
If you need reference please check 'Test Notification' notification on https://demo011.service-now.com/login.do
user - admin
password - admin
Thanks,
Tanaji

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 12:56 AM
Also you can personalize/configure list layout to add 'stage' and use excel export of 'sc_req_item' table to see the value of the stages.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 12:57 AM
And also make sure you check 'send to event creator' in the notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 09:51 AM
Thanks Tanaji,
I will check on this and report if successful.