- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 04:39 AM
Hello all,
A colleague created a UI action on the 'ticket' form, which opens a service portal page when clicked. It passes the sys_id of the current record, as a parameter. The code in the UI Action is this:
function selectStandardChange(){
var url = 'sp?id=request_standard_change&sysparm_domain_restore=false&sysparm_stack=no&ticket_sys='+g_form.getUniqueValue();
window.open(url, "_self");
return false;
}
And, we have 'selectStandardChange()' in the 'OnClick' field.
This works perfectly. But, we're trying to create a similar UI Action to open a different service portal page. The UI Action is exactly the same, except that the OnClick function has a slightly different name, and we're referencing the other service portal page:
function selectStandardChangeWD(){
var url = 'sp?id=request_standard_change_webdev&sysparm_domain_restore=false&sysparm_stack=no&ticket_sys='+g_form.getUniqueValue();
window.open(url, "_self");
return false;
}
But, this one doesn't work. The UI Action is visible on the form, but when clicked the service portal page does not open. The OnClick function is definitely being called (I put an alert in before the 'window.open' line to test that).
More bizarrely, if we copy the original UI Action (do an Insert) the new UI Action also does not open the page, even though the original does and is exactly the same. Any thoughts on what's going on here?
Thanks
Jamie
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 05:42 AM
Replace
window.open(url, "_self");
with
g_navigation.openPopup(url);
Final code should look like this:
function selectStandardChangeWD(){
var url = 'sp?id=request_standard_change_webdev&sysparm_domain_restore=false&sysparm_stack=no&ticket_sys=' + g_form.getUniqueValue();
g_navigation.openPopup(url);
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 06:24 AM
Hi,
New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure UI Action form layout and add the "Isolate script" field.
After adding mark that checkbox as true and try your same UI action. IT Should work. check this property as well "glide.script.block.client.globals" which should be marked as false.
Hope this help. Please mark the answer as helpful/correct based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 06:27 AM
Thank you Shloke, this is handy to know 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2023 07:38 PM
Just adding this for anyone looking to open the link in a new tab.
Use:
g_navigation.open(url, '_blank');