Script to close current window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 12:35 AM
Hello All,
Can any one tell me how many ways are there to close the window.
can you provide me the script to close the window.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 12:48 AM
Hi sunil,
there are a lot of ways, it depends on your need, below some examples:
1) through a UI Action
GlideDialogWindow.get().destroy();
2) through a Business Rule
g_scratchpad.close_window = gs.action.getGlideURI().toString().indexOf('sysparm_close_window=true') != -1;
3) through an OnSubmit Client Script
if(g_scratchpad.close_window){
g_form.submit();
window.top.close();
}
Hope this will help to fit your need.
Please, remember to mark Correct or Helpful if you find my response useful.
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 07:34 AM
Hi.. I used the below code in UI Action script:
GlideDialogWindow.get().destroy();
It redirected me to the last visited page in the same tab.. Is there a way to simply close that tab when the button is clicked?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 12:48 AM
Hi
"Window" here refers to which window? Service Portal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 03:30 AM
any form like incident.