The CreatorCon Call for Content is officially open! Get started here.

UI Action script (client side) to save record & close the current window.

Ankita Kolhe
Tera Contributor

Hi Community,

 

I have a 'Save & Close' UI Action to save the record & close the current window.

However below code is not working:-

 

g_form.save();

window.close();

 

AnkitaKolhe_0-1698756596293.png

 

AnkitaKolhe_1-1698756629556.png

 

 

Could anyone please help with the same?

Any response will be appreciated.

 

Thanks,

Ankita

6 REPLIES 6

Muhammad Ahsan
Tera Contributor

Can you try this:

var myWindow = window.location.href

myWindow.close()

SANDEEP28
Mega Sage

@Ankita Kolhe Create UI action as below.  No need to include onClick function. I tested on incident table and it works.

 

SANDEEP28_0-1698757301001.png

 

SANDEEP28_1-1698757324405.png

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

@Ankita Kolhe have you tried this ?

Isaac Vicentini
Mega Sage
Mega Sage

Keep in mind that the ability to close a browser window from a script may be restricted due to browser security settings. In many modern browsers, pop-ups can only be closed directly if they were opened by the script itself.

 

Additionally, it is important to use this with caution, as closing a window without the user's permission can be intrusive and is not considered best practice in many scenarios.

 

Why was this solution used? Maybe we can find an alternative.

 

If necessary, try using this code:

 

var currentWindow = window.self;
currentWindow.opener = window.self;
currentWindow.close();

 

 


Best regards,

Isaac Vicentini
MVP 2025


If my answer was helpful, mark it as Helpful or Accept as Solution.