- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 09:30 AM
i have an existing catalog client script that fires on new value. It pops an alert and then is supposed to redirect the user to the appropriate request. The problem is that we don't want it to open in a new window, but in the current window replacing the first request item.
Here is what I have:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Redirection to eRequest/Access Request from Report Request in Portal
//Type appropriate comment here, and begin script below
if (newValue == 'Access to reports') {
top.window.setTimeout(tab2, 2000);
// Open a new tab in ServiceNow in Access Request - Application Access request
function tab2() {
// url = "/sp?id=sc_category&catalog_id=e0d08b13c3330100c8b837659bba8fb4&sys_id=3865aad81b274c10353820ecac4bcbb8";
url = "/sp?id=sc_cat_item&sys_id=5599666b1bafc010353820ecac4bcb56&sysparm_category=3865aad81b274c10353820ecac4bcbb8";
// alert("You will be redirected to Access (formerly eRequest) / Application Access request.");
alert("Click OK or the link in the pop up blocker to be redirected to 'Access (formerly eRequest) / Application Access' request in another tab. If you are not automatically redirected, go to the Service Catalog and select 'Access (formerly eRequest)' then choose 'Application Access.");
// top.window.location ="/sp?id=sc_category&catalog_id=e0d08b13c3330100c8b837659bba8fb4&sys_id=3865aad81b274c10353820ecac4bcbb8";
top.window.open(url);
}
}
}
I am having a difficult time finding any alternative that would allow me to open the url in the same window. Any ideas would be most welcomed!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 10:34 AM
Can you please try this:
top.window.open(url,'_self');
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 10:34 AM
Can you please try this:
top.window.open(url,'_self');
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 12:31 PM
Prince, thank you so much! That was the right answer. I had tried a variation of that, but I don't think I had the verbiage quite right. I really appreciate the help!