Send email notification from Runscript in workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 08:06 AM
I would like to send meail notifcation from the runscript(workflow). I wrote below code but doesnt seem like working. Should something be configured before doing that? how to send variables.
Basically I am doing SOPA call, when SOAP execution fails, I would liek to send an email with form varibales?
Edit:added below screenshot
Thnak You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 08:08 AM
You need to use gs.eventQueue() method from run script to send email notification.
https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_automatingapps_madrid_generating_events?v=madrid
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 08:10 AM
You have not pasted any code? You can create a new event for your notification and call it from any server side scripts to trigger your notification.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 08:11 AM
Hi,
Trigger an event from workflow. And configure your notification to listen to that event.
Check this article which explains how to trigger notification using events.
Mark the comment as a correct answer and helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 01:27 PM
I created event in workflow activity and email notification. Called it from code. It didnot work
Attaching: event,workflow and email notification
Code to call event
var response = sm.execute();
var status = response.getStatusCode();
if(status != '200'){
alert("cannot put ticket in pinnacle");
}
gs.eventQueue('sc_req_item.sendEmailToPinnacle',current);
Can anyone help why is it not working?