Creating Send Email UI Action on Service Portal Page with option to Preview before Send

sureshhegde
Kilo Contributor

We are trying to create a Send Email custom UI Action on one of our Service Portal page similar Send Email from the backend on any of the form/ticket. We are also looking for ability to preview the email before clicking Submit. So, was looking if anyone here has any recommendation or suggestions for the same, as I wasn't able to find anything on the community.

Looking for the response.

Thanks,

Ashwath

1 ACCEPTED SOLUTION

Manish Vinayak1
Tera Guru

Hi Ashwath,

The email preview functionality uses the following URL in the background to generate the email preview:

https://<your-instance-name>.service-now.com/notification_preview_html_body.do?sysparm_record_id=<record_sys_id>&sysparm_user_id=<logged_in_user_id>&sysparm_event_id=&sysparm_notification_id=<notification_sys_id>

 

where record_sys_id is the sys_id of the record for which you want to preview the notification,

logged_in_user_id is the sys_id of the logged in user,

notification_sys_id is the sys_id of the notification record that you have configured for that record

 

You can use that URL, as a link in a widget which opens the preview in a new tab. Or you can try to create iFrame inside your widget, to show that page which renders the notification.

 

Here's an article I had written to have a UI Action on any table record (not on a service portal though) to preview notification before sending it. It uses UI page as a solution, you can try to convert the logic to a widget.

https://community.servicenow.com/community?id=community_article&sys_id=b1ba0acddbc7f708d82ffb2439961...

 

Hope this helps!

Cheers,

Manish

View solution in original post

7 REPLIES 7

What is notification_preview_html_body? is it a custom UI Page you created. As the out of the box UI Page is named notification_preview. When I leverage the above url in my widget looks like it is complaining saying record not found as there is no notification_preview_html_body.

Looking forward for your response.

 

Thanks,

Ashwath

Looks like notification_preview_html_body UI Page is available in London instance and higher. Right now we are on Kingston and we will be upgrading only in a month or so. Is there a way that I can get this working without upgrading the instance?

 

Thanks,

Ashwath

Oh I deduced that using a London instance I guess.

I had gone to the email notification record, clicked the preview notification button to figure out what parameters are passed to the UI Page. I don't have access to any Kingston instance so unfortunately I can't give you an accurate answer on this one. The code which renders the UI Page is present in the UI Action (Preview Notification). You can try and see in the Kingston Instance to find out which UI Page it renders, what are the parameters it takes. If it doesn't accept the table name, record id as the parameter and you can't find the implementation logic for the UI Page just as in London and other versions, you can try to figure out the URL of the final page being generated using the developer tools in your browser. That's what I did to find out the one working in London.

Hope this helps!

Cheers,

Manish