1

I have a custom javascript button to display send email as a popup window. Basically it opens a new page.I would like to set a Default Template and Email From Address when user select Email send button. I found the solution for this but when i club it I am getting an error.

  1. Send Email custom button javascript:

    window.open("/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&retURL=%{!Case.Id}","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650");
    
  2. To select default template and from address the code is:

    location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00XCXXXXXXXXXXX&p26=support@xxx.com');
    

How can I club 1 and 2 together in a single javascript custom button?

  • Did you try replacing everything from email/ in the first with everything from email/ in the second and just use that – Eric Jan 19 '17 at 23:38
  • Hello Eric, can you tell me how to do this? I tried but it was showing an error when clicking on the custom button. – LMK Jan 19 '17 at 23:54
  • What did you try? It's a simple copy and replace with your favorite editor. – Eric Jan 19 '17 at 23:56
  • This is what I did window.open("/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&retURL=%{!Case.Id}","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650" location.replace('/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00XCXXXXXXXXXXX&p26=support@xxx.com'); – LMK Jan 19 '17 at 23:57
  • 1
    And what final string did you use? What is the error – Eric Jan 19 '17 at 23:57
0

You can simply use window.open("/_ui/core/email/author/EmailAuthor... and pass all the parameters together including Default Template and Email From Address as below. This will open in a new window with pre-populated values provided in the URL and using default template.

window.open("/_ui/core/email/author/EmailAuthor?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&p26=support@xxx.com&template_id=00Xi0000000Kbba","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650");
| improve this answer | |
  • Hello Saroj, Thanks for the reply. I tried doing this and I got an error which says "A problem with the OnCLick JavaScript for adding this button or link was encountered. Invalid or unexpected token". The JS i gave according to your answer is [window.open("/_ui/core/email/author/EmailAuthor?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&p26=xxxxxx@xxxx.edu &template_id=00X3C000000YR1L","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650");] – LMK Jan 20 '17 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.