- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 02:49 PM
I have a UI action 'Button' and my goal is to open a child form(escalations) in a new tab.
I use the following -
Client = True
Onclick = openInNew()
Script -
function openInNew(){
var parent = new GlideRecord("x_123456_app_case");
g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent.sys_id);
}
The problem I am having -
The function works only in the following case,
function openInNew(){
var parent = new GlideRecord("x_123456_app_case");
g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent.sys_id);
}
I need to pass the parent sys_id as a URL parameter.
Looking for help,
Regards,
Yogesh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 02:55 PM
Hello Yogesh,
Is the parent field on the current form? If yes then replace var parent = new GlideRecord("x_123456_app_case"); with
var parent = g_form.getValue('parent'); and replace g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent.sys_id); with g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent);
Reference article on how to adjust client and server side code.
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 02:55 PM
Hello Yogesh,
Is the parent field on the current form? If yes then replace var parent = new GlideRecord("x_123456_app_case"); with
var parent = g_form.getValue('parent'); and replace g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent.sys_id); with g_navigation.openPopup('x_123456_app_escalations.do?sysparm_query_override=case_id=' + parent);
Reference article on how to adjust client and server side code.
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 04:30 PM
Thanks Pradeep, that worked for me with a slight change,
var parent = g_form.getUniqueValue();
Thank you again, appreciated,
Yogesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2018 01:48 PM
I have a similar requirement. is there any way to pass the following parameters into g_navigation.openPopup().
g_navigation.openPopup('testkb?spa=1&query='); // this works
but I need to pass the following parameters in the url:
var url = "testkb?spa=1&query=" + escape(current.short_description) + ' ' + escape(current.u_test) + "&sysparm_operator=IR_OR_QUERY";
g_navigation.openPopup('url'); //doesnt work
Any idea? Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2024 08:43 AM
Try g_navigation.openPopup(url);
'url' is a String.