- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 10:39 AM
I want to open a new form for a table and prepopulate some of the values on that form when it opens.
I want to do this from a ui action.
I have the correct url - if i paste my url into my browser the form opens on the correct table with the description field prepopulated correctly.
i have a client script, show on update, client is checked, onClick is createMyNewRecord(), script is
function createMyNewRecord(){
var url = 'my url';
i realize that action.setRedirectURL(url); is for server side.
how do i get the form to open in a new window from this client script???
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 06:52 PM
The correct API to use is GlideNavigationV3
g_navigation.open(url, target); //Redirects to a new URL.
g_navigation.openPopup(url, name, features, noStack); //Opens a popup window.
g_navigation.openRecord(tableName, sys_id); //Redirects to a record. The record will be displayed in the navigator.
Where ServiceNow API exists it should be used in place of native JS functions.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 04:36 PM
Hi, for client side you can use window.open or window.location to redirect to particular form.
var sysId = g_form.getUniqueValue();
var url = '/<tableName>.do?sys_id=' + sysId;
window.open('url');//Form will open in new window
OR
you can use
window.location="your url";//form will open in same window
Mark Correct /helpful,if it helps.
Regards,
Ragini

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 06:52 PM
The correct API to use is GlideNavigationV3
g_navigation.open(url, target); //Redirects to a new URL.
g_navigation.openPopup(url, name, features, noStack); //Opens a popup window.
g_navigation.openRecord(tableName, sys_id); //Redirects to a record. The record will be displayed in the navigator.
Where ServiceNow API exists it should be used in place of native JS functions.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2021 03:27 AM
Hi,
You can directly use gs.setRedirect('url'); without giving any action name or function name and without checking client checkbox. action.setRedirectURL('url'); was not working for me but gs.setRedirect('url'); did work.
Please mark correct/helpful if it works for you..
Regards,
Shivam