Scoped GlideEmailOutbound has no send or save method

jakejeon
Tera Contributor

I checked multiple times, but I can’t find any send or save method in the Scoped GlideEmailOutbound API.

Am I misunderstanding something, or is this a limitation of the API itself?

 

var mail = new GlideEmailOutbound();
mail.setSubject("Subject");
mail.setReplyTo("me@example.com");
mail.setBody("Body");
mail.send();

 

When I run this, I get the following error:

Cannot find function send in object com.glide.notification.outbound.ScopedEmailOutbound

The same error occurs when I try mail.save().

Based on the API definition, GlideEmailOutbound only provides methods such as:

  • setSubject()
  • setBody()
  • setReplyTo()
  • addAddress()

but no method to actually send or save the email.

 

Server Scoped API | ServiceNow Developers

 
1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

GlideEmailOutbound is not intended as a standalone API for sending emails, it's an API used as part of mail scripts for amending the data as part of a notification record. You can't call GlideEmailOutbound within another scripting area of the platform to generate an email. Instead, you should fire an event and create a notification record that triggers from that event.

View solution in original post

1 REPLY 1

Kieran Anson
Kilo Patron

GlideEmailOutbound is not intended as a standalone API for sending emails, it's an API used as part of mail scripts for amending the data as part of a notification record. You can't call GlideEmailOutbound within another scripting area of the platform to generate an email. Instead, you should fire an event and create a notification record that triggers from that event.