- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:49 AM
Hello,
I'm trying to put a dialog box on a catalog item. I want it to inform the user that they need to attach a form to the catalog item before they can proceed. If the user clicks 'ok', it should load the catalog item. If they hit 'cancel' it should redirect them to the Service Catalog.
Right now, hitting 'ok' works fine, but trying to redirect to the catalog isn't working. When the user hits 'cancel' in I.E.11, it closes the tab and opens a new one at the service catalog. However, in Firefox, it just loads a new tab at the service catalog, but loads the catalog item in the original tab. Below is the code I'm using for the Catalog Client Script. Any and all help would be greatly appreciated!
function onLoad (control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
//var portalURL = getTopWindow().location.toString();
var con = confirm("You must fill out and attach the Move form to complete your request.\nOnce you download the Move document, you can press Home at the top of the screen to leave this form.");
if(con == false) {
window.top.close();
//window.open(portalURL);
window.open('https://stateofohiodev.service-now.com/ess/home');
}
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 12:28 PM
I always seem to have trouble with window statements in server side scripts - can you try this:
window.open('https://stateofohiodev.service-now.com/ess/home', _self);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 11:41 AM
have you tried window.location.assign() as opposed to window.open - seems to me window.open is supposed to open a new tab / window?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 12:01 PM
function onLoad (control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
//var portalURL = getTopWindow().location.toString();
var con = confirm("You must fill out and attach the Move form to complete your request.\nOnce you download the Move document, you can press Home at the top of the screen to leave this form.");
if(con == false) {
window.top.close();
//window.open(portalURL);
window.location.assign('https://stateofohiodev.service-now.com/ess/home');
}
}
Is this the correct placement of that code? I tried that and it didn't load the form, but it also stayed on that page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 12:28 PM
I always seem to have trouble with window statements in server side scripts - can you try this:
window.open('https://stateofohiodev.service-now.com/ess/home', _self);