How to add email client template parameter in popupOpenEmailClient

Ravindra Rausha
Giga Contributor

Hi,

I have created two email client template for incident. So I want to populate specific email client template in email client window.

How to add email client template parameter in popupOpenEmailClient?

Thanks,

Ravindra

1 ACCEPTED SOLUTION

Chetan Sondhi
Kilo Sage

Hi Ravindra,



Hope you doing well .


For this what you can do is to have your custom client email icon set and that can be achieved by onLoad Client Script .


You can set the email client template based on any value for Incident form by setting the parameter in popupOpenEmailClient function like this :



popupOpenEmailClient("email_client.do?sysparm_table=incident&sysparm_sys_id="+id+"&sysparm_target=incident&sys_uniqueValue="+id+"&sys_row=0&sysparm_encoded_record=&incident.u_client_mail_type="+clientType+"&sysparm_stack=no");



Here, u_client_mail_type is a field on the basis of which I am setting the email client parameter.


You also have to add condition with the two Email Client Templates that you have in Email Client Template table.


For e.g. EmailClientTemplate1 with condition "u_client_mail_type=assigned_to"


& EmailClientTemplate2 with condition "u_client_mail_type=user"



I've tried this at my instance and it worked .Client Script is something like this :



find_real_file.png



In this I'm hiding the OOB Email Client icon and insert my customized one.



find_real_file.png




This will help you brother 🙂



PS - Please mark Helpful, Like, or Correct Answer if applicable.


View solution in original post

8 REPLIES 8

Chetan Sondhi
Kilo Sage

Hi Ravindra,



Hope you doing well .


For this what you can do is to have your custom client email icon set and that can be achieved by onLoad Client Script .


You can set the email client template based on any value for Incident form by setting the parameter in popupOpenEmailClient function like this :



popupOpenEmailClient("email_client.do?sysparm_table=incident&sysparm_sys_id="+id+"&sysparm_target=incident&sys_uniqueValue="+id+"&sys_row=0&sysparm_encoded_record=&incident.u_client_mail_type="+clientType+"&sysparm_stack=no");



Here, u_client_mail_type is a field on the basis of which I am setting the email client parameter.


You also have to add condition with the two Email Client Templates that you have in Email Client Template table.


For e.g. EmailClientTemplate1 with condition "u_client_mail_type=assigned_to"


& EmailClientTemplate2 with condition "u_client_mail_type=user"



I've tried this at my instance and it worked .Client Script is something like this :



find_real_file.png



In this I'm hiding the OOB Email Client icon and insert my customized one.



find_real_file.png




This will help you brother 🙂



PS - Please mark Helpful, Like, or Correct Answer if applicable.


Hi Chetan,



Thanks it works for me.


That's Great !!


Hello,

Thank you for the tip.

Actually, we can simplify the url. It is not necessary to add the parameter ";incident.u_client_mail_type="+clientType+" in popupOpenEmailClient. The condition of the client email template is enough.

var url = "email_client.do?sysparm_table=incident&sysparm_sys_id="+id+"&sysparm_target=incident&sys_uniqueValue="+id;
popupOpenEmailClient(url);