GlideEmailOutbound()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 11:39 AM
Hi All,
GlideEmailOutbound is a ServiceNow class used to create and send outbound email programmatically. It's part of the platform's scripting environment, allowing developers to automate the sending of emails with custom content, recipients, and attachments.
Key Methods of GlideEmailOutbound:
addAddress(String type, String address)
Adds an email address to the recipient list. The type parameter specifies the type of address (e.g., "to", "cc", "bcc").var email = new GlideEmailOutbound(); email.addAddress("to", "example@example.com");setSubject(String subject)
Sets the subject line for the email.email.setSubject("Email Subject");setBody(String body)
Sets the body content of the email.email.setBody("This is the email content.");addAttachment(String tableName, String recordSysId)
Adds an attachment to the email from a specific table and record.email.addAttachment("incident", "sys_id_of_record");setReplyTo(String email)
Sets the "Reply-To" address for the email.email.setReplyTo("replyto@example.com");send()
Sends the email.email.send();
Example Usage:
This class is useful for sending custom notifications that aren't covered by ServiceNow's standard notification engine, allowing more flexibility in automating processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2025 07:09 AM
Hi @Sumanth16 - I haven't found any official documentation or evidence that GlideEmailOutbound includes an addAttachment method. Is this content perhaps generated by a GPT model? From my understanding, there isn’t a built‑in way to attach files directly with GlideEmailOutbound. This is supported by KB0789188:
As of now there is no attachment manipulation is available in GlideEmailOutbound from scripting layer.