- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 08:35 AM
I have written below code in ui action client script , it is working fine if but it is opening a link in new window outside of agent workspace but I want to open it in the new tab with n agent workspace only. Could someone help me how should I achieve this.
function onClick(g_form) {
var url = 'sp?id=sc_cat_item&sys_id=14287122db109050665dd855ca961914&parent=' + g_form.getUniqueValue();
open(url);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 11:48 AM
My bad I thought you want to open new browser tab.
To open inside the workspace tab, have you checked g_service_catalog.openCatalogItem()
eg: you can refer ootb UI Action, "Create Request"
Reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 09:22 AM
yup basically we want to work this on client script only in ui action.
This one works but opens a new window outside agent workspace:
function onClick(g_form) {
var url = 'sp?id=sc_cat_item&sys_id=14287122db109050665dd855ca961914&parent=' + g_form.getUniqueValue();
open(url);
}
As Harsh mentioned tried by using below code but it didn't even open the window so this.open is nor working.
function onClick(g_form) {
var url = 'sp?id=sc_cat_item&sys_id=14287122db109050665dd855ca961914&parent=' + g_form.getUniqueValue();
this.open(url,'_blank');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 11:46 AM
If you are using it in client script and testing it on native UI then use below code.
window.open('https://www.google.com/','_blank');
For Workspace:
this.open('https://www.google.com/','_blank');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 11:09 AM
Hi Harsh,
any other function which you think we can use.
I tried using g_aw.openRecord() but didn't work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 11:48 AM
My bad I thought you want to open new browser tab.
To open inside the workspace tab, have you checked g_service_catalog.openCatalogItem()
eg: you can refer ootb UI Action, "Create Request"
Reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 11:59 AM
When I tried using the g_service_catalog.openCatalogItem(), it gives me below error.
function onClick(g_form) {
//var url = '/sp?id=sc_cat_item&sys_id=14287122db109050665dd855ca961914&parent=' + g_form.getUniqueValue();
var params ={};
params.parent= g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item', '14287122db109050665dd855ca961914', params);
}