Set default values in email client from script

brumiou
Mega Guru

Hi,

 

I'm opening an email client window from a ui macro (the purpose is to have a mail icon next to a field).

To open the client I'm using this script :  

 


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


It works fine.

 

But now I want to set the value of the from, to ans subject field.

I've tried a lot of thing, but without any chance.

 

Do you know a way to set the value of these fields in the mail client popup?

 

Thanks a lot

 

rgds

 

Xavier

1 ACCEPTED SOLUTION

brumiou
Mega Guru

Hi,



maybe it can help somebody, but I've managed to do it.


I've created a field called u_client_mail_type as a choice field with different velues in it : assigned_to, technical_correspondant, user.


For each value I've created a client mail template with this field and value in the condition.



And in the ui macro, I simply call the popupOpenEmailClient like that :





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



the important part is the incident.u_client_mail_type=assigned_to at the end of the url, to select the template I need.



The field doesn't have to be on the form, it's just used in the template condition.



rgds



Xavier


View solution in original post

12 REPLIES 12

kreddyT
Mega Contributor

yes, its in email client template.



I used your javascript line and its working now.



Thank you so much.


BK9
Tera Contributor

I set the link in the UI action, so it wasn't the URL.



I did change the conditions in the default email client template to exclude the client mail type, which has seemed to work, but seems a little risky.


sajan0192
Giga Expert

Hey Xaviour,



I want to create a UI action. Onclick of that UI action email client window should get open and in the body content all the values from comments should get populated.



Can you advice me how can I achieve this requirement.