How to get email record sys id in email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 08:27 AM
Hello experts!!
How to obtain the SysID for the email records that we can view in the email logs.
I've attempted email.sysId, sys email.sysId, email.getUniqueValue, etc.
Help, please, since nothing is working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 08:43 AM
Need more information on what exactly you are trying to do. Is this for an inbound action or an email script for an outbound notification? Or something else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 08:52 AM
I've email notification, My requirement is to get the sysId of sys_mail.
In the email script we have below fields, How can we get triggered email(Sent email , sys_email) sys Id
- current (GlideRecord API)
- email (GlideEmailOutbound API)
- template (TemplatePrinter API)
- event (only for notifications responding to events)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 09:00 AM
Not possible, the sys_email record has not been created yet as far as I am aware. Why do you need to get the record? What is it you are trying to do? If I knew I maybe able to point you in a direction that will get you what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 09:04 AM
I'm trying to create PDF and want to add it in email as attachment. Using below code for that.
It requires "targetTableSysId" so i want sysEmail sysId for that
//Create PDF in Attachment table
var v = new sn_pdfgeneratorutils.PDFGenerationAPI;
var result = v.convertToPDF(htmlText, targetTable, targetTableSysId, pdfName);
gs.info("PDF Result :"+JSON.stringify(result) );