
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 04:36 PM
Can someone point me in the direction of how to send an email directly from a UI Action script? Sorry if I'm missing something obvious, but I haven't found this documented as yet.
As an example, on a Change Request, I want to add a UI Action that gives me a "Start Work" button. When the owner of the CR hits that button, I'll (amongst other things) have the UI Action script send an email to the change advisory board to let them know the CR is starting. I essentially want the equivalent of Javascript:
SendEmail("changeboard@somewhere.com", "This is the subject", "This is the HTML body");
Or
SendEmail("changeboard@somewhere.com", UsingThisTemplate);
Is there such a thing, or something along those lines?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 06:09 PM
While not as flexible as a notification, you can hard code an email via script that can be called by a UI action. Below is an example:
var emailNotification = new GlideRecord('sys_email');
emailNotification.type = 'send-ready';
emailNotification.subject = 'Email subject';
emailNotification.body = 'Email body';
emailNotification.recipients = email-adress1 + ',' + email-address2;
emailNotification.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 04:39 PM
HI Steve,
It could be achieved by creating a email notification and then trigger the notification from UI Action by triggering the event.
http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification
The other option is, OOTB we do have email client functionality. Is that something you are looking for.
Enabling the Email Client - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 05:05 PM
Okay - so I can't do it directly, but maybe I can create a new field "InProgress", have the "Start Work" UI Action set InProgress to true, and then a new event that fires a notification whenever InProgress is set to true. I'll have to experiment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 06:09 PM
While not as flexible as a notification, you can hard code an email via script that can be called by a UI action. Below is an example:
var emailNotification = new GlideRecord('sys_email');
emailNotification.type = 'send-ready';
emailNotification.subject = 'Email subject';
emailNotification.body = 'Email body';
emailNotification.recipients = email-adress1 + ',' + email-address2;
emailNotification.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 09:35 PM
Lovely! Exactly what I needed