function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lakshmi Kumar 7Lakshmi Kumar 7 

autoclose popup window on a custom button after hitting “Save”

Hello all,
I have implemented a custom Javascript button called "Send Email" under Activity history. When a user clicks this button a new popup window should open that enables the user to send an e-mail. The JS code also displays the default from address, to address and template for the user. The new requirement is that after the user clicks the "Send" button, the popup window should auto-close. Find the code used to open the pop-up window below.

[window.open("/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&p2_lkid={!Case.ContactId}&p26=xxx@xxx.com&template_id=xxxxxxxxxxxxxx&retURL=%{!Case.Id}","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650");
Could someone please suggest on how to auto-close this pop-up window?


 
bob_buzzardbob_buzzard
In modern browsers only the page that opened the window is allowed to close it, so you'll need to find a way to execute some JavaScipt on the parent page that closes the popup. I doubt you'll be able to do this as the URL you are opening is to a standard page so you can't inject arbitrary JavaScript into it without creating a chrome plugin or similar.