I have to enable email preview on workspace

Nivetha23jay
Tera Contributor

Hi guys,

I have a requirement where I have to create preview mail option which will be showed under form menu of email tab that is available under service operations workspace, kindly let me know how to enable it

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Nivetha23jay 

 

It would be a great customization for the system.

You would need to create a new button and write code to fetch the email content and display it as a preview.

You can use the email logs to generate the preview.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

jennv
Mega Guru

hi, did you find out how to do that? i have a similar situation.

anand-bhosle
Tera Guru

Hello @Nivetha23jay 

 

This is interesting to see. I see two options, the first one is obvious to enable existing "preview action by going to sys_email table > UI action (Preview HTML Body). Make It enable to workspace, save & test.

 

2nd approach which I would do is creating a Brand new UI action on sys_email table and make workspace form button to Checked/True.

 

.Screen Shot 2025-05-02 at 1.38.34 PM.png

(function runPreview() {
// Use the built-in 'email_preview' UI Page to render the body
var modal = new GlideModal('email_preview');
modal.setTitle('Email Preview');
modal.setSize('large');
modal.addParam('sysparm_sys_id', current.sys_id);
modal.render();
})();


There is a UI Page named preview_email (oob or one you clone) that reads the sysparm_sys_id parameter, loads the sys_email record, and prints its subject and body (HTML or text).


You can explore more here by checking the documentation 

https://www.servicenow.com/docs/csh?topicname=c_GlideModalV3API.html&version=latest

 

Try this and mark my reply as correct if you answer your questions.

Thanks

Anand

Hello Anand, very good example, but in workspace we cant use GlideModal, only g_modal. Do you have any idea how to achieve the preview email button in this case?