How to display email on incident form.

Dotychczas
Mega Guru

Hello Eperts,

I have ui action and I want it to show modal with email body, subject and recepients. 

function clickPreview() {

    var ga = new GlideAjax('ajax');
    ga.addParam("sysparm_name", "getEmail");
    ga.addParam("sysparm_interaction_number", g_form.getValue('u_interaction_record'));
    ga.getXML(getResponse);

    function getResponse(response) {
        var result = JSON.parse(response.responseXML.documentElement.getAttribute('answer'));
        var msg = getMessage("Preview Email");
        var dd = new GlideModal("preview_email");
		alert(result.body);
        dd.setTitle(msg);
        dd.setWidth(800);
        dd.setPreference('sysparm_id', result.sys_id);
        dd.render();
    }
}

Now I'm just pushing email's sys id and it displays ok but subject and recepients are missing. I'm also fetching email data from sys_email table. So i have access to all the info from email record. Setting up modals is new for me so I'm not sure how can I add data that I need easly. 

4 REPLIES 4

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Dotychczas 

 

OOTB we already have UI Action 'Preview Notification' which does almost same. You can try to replicate same here and see if that works.

 

UI Action link:

https://devXXXXX.service-now.com/now/nav/ui/classic/params/target/sys_ui_action.do%3Fsys_id%3D2a2ed4...

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Hi, 

that didn't exactly help. Change of fields in this ui action is impossible due to no access to template that it uses. I found out that it can be changed in script include but this will be to big of a change and I'm afraid that I would mess other places where preview notification is being used. I need better explanation how it can be set up. I already fetch necessary data in ui action.

But thanks for your input anyway.

Kind Regards.

You can't edit fields in provided ui action due to restricted access to template. You can workaround changing script include but I rather want to avoid that as it could impact other places that use it. 

ramlakshman
Tera Contributor

Hi Mega Guru,
my requirement is same if you have got solution please share the code it helpful to every one.

Thanks,
Lakshman