To open a different Client Email Templates through different buttons(UI Macros)

urmilla
Kilo Guru

Hello,

What I essentially need to implement are multiple buttons within the same form next to different sets of fields to send emails , each of which should open a specific email template.

Although I can provide conditions on the email client templates to have certain values from the form to determine which email template should be opened. But this will get implemented across the other buttons aswell.

I am looking at possible solutions which will enable me to open a template from the button and it being independent of any field values.

I am using   popupOpenEmailClient . Is there a way to embed the email template within this?

Thanks,

Urmilla Dhar

17 REPLIES 17

Also If I am using below code it doesn't pick the template.



popupOpenEmailClient("email_client.do?sysparm_target=u_work_order&sysparm_table=u_work_order&u_work_order.u_ui_action_type=SAN&sysparm_sys_id=" + id + "&sys_uniqueValue=" + id);



But If I use emailClientOpenPop isntead of emailClientOpenPop, it is picking correct template but not sending emails. Could you point me to the right direction?



emailClientOpenPop("email_client.do?sysparm_target=u_work_order&sysparm_table=u_work_order&u_work_order.u_ui_action_type=SAN&sysparm_sys_id=" + id + "&sys_uniqueValue=" + id);


Sam179
Tera Contributor

Hi. I have a similar requirement. Were you able to figure it out?

Ian Catley
Tera Contributor

 

The email_client.do doesn't have any built in functionality to recognise the parameter sys_email_client_template. For this to work you need a query business rule on the email client template table along the following lines:

(function executeRule(current, previous /*null when async*/) {
       var url = gs.action.getGlideURI();
       var name = url.get('sys_email_client_template');
       if (!JSUtil.nil(name)) {
            current.addQuery('name', name);
       }
})(current, previous);