Mail Script - how to get sys_id of current email

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 05:06 AM
Hi, I need to be able to get the sys_id of the email being sent out inisde the mail script.
Anyone have suggestions on how this could be done? This has to work for both email notifications and e-mail sent using Email Client.
I thought the "email" or "email_action" object would help but it seems none of those objects allow to get the sys_id of the current email.
Thanks in advance for any pointers.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 07:29 AM
You do not need to create a watermarking system. That already exists. The sys_watermark table links watermarks to sent emails.
I am with Ankur. What is the business problem you are trying to solve?
It seems like you should model your solution based on how ServiceNow manages email approvals. ServiceNow creates a separate record for each person who receives an approval notification. When an email approval is received, they do not link it to the task or the sent email. They link it to the sysapproval_approver record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 07:50 AM
Ah, you're right that is a good point. I just double checked and indeed the OOB watermark has reference to both target record and the email record. That might work, but only as long as clients have watermarks turned on.
The page needs to process the body of the email, from which the URL was clicked. And only the body of that very email from which it was clicked.
If there might be another way to achieve that, I'm open to suggestions 🙂