Open a sys_email record directly from the Activity log? Easy!
For quite a long time I have been trying to figure out a way to do this without modifying the 'EmailDisplay' Processor, and it looks like I finally managed to, partially thanks to ServiceNow introducing a new property to store the email body style settings in one of the last few releases.
What am I talking about? How about an easy, 1-click way to open a sys_email record straight from the Activity log?
Here's how to achieve this.
- Create a new String property glide.ui.activity.style.email
- Set its value to this script:
} </style> <script> function goToEmail() { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const email_id = urlParams.get('email_id'); window.open('/sys_email.do?sys_id=' + email_id, '_blank'); } </script><p><button onclick="javscript: goToEmail()">Open Email record</button></p> <style> <!-- PUT YOUR CUSTOM EMAIL BODY STYLE HERE --> body {
And voilà! Now when you click the 'Show email details' link, you will see a button on top of the email body that, when clicked, will take you directly to the email record!
UPD: Now available on Share!
https://www.servicenow.com/community/developer-articles/open-a-sys-email-record-directly-from-the-activity-log-easy/ta-p/2323109