- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 10:58 PM
Hi all, I've got a catalog item that I need to control the redirect after it's submitted in Service Portal. I need this to work much like "producer.redirect", but in an onSubmit catalog client script on a catalog item (not a record producer)...I only need this redirect if certain variable values are set...that's why I want to use the onSubmit catalog client script. Is this possible? I'm seeing some threads that suggest using:
var URL = "sp?id=index;
top.window.location = URL;
which kind of works, but I'm seeing some comments not to use this, and when you click "Submit" I get this first, and then it redirect correctly.
I only need to redirect for one specific scenario, and I'd like to not clone the SC Catalog Item widget to do it. Any thoughts?
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 11:12 PM
var URL = "sp?id=index";
top.window.onbeforeunload = null;
top.window.onunload = null;
top.window.location = URL;
You could try this. I have no idea if it will work, but it was one of the options provided in
Here by MB
I recently tackled this issue myself on record producer so I was interested in what would be needed on a catalog item. Let me know if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 11:06 PM
Hi Patrick,
So if user is redirected to that url; the record producer won't submit though; is that expected behavior?
Also I believe that alert you are getting from browser since you are setting some field values and moving away from that page
Mark ā
Correct if this solves your issue and also mark š Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 11:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 11:12 PM
var URL = "sp?id=index";
top.window.onbeforeunload = null;
top.window.onunload = null;
top.window.location = URL;
You could try this. I have no idea if it will work, but it was one of the options provided in
Here by MB
I recently tackled this issue myself on record producer so I was interested in what would be needed on a catalog item. Let me know if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-12-2019 11:19 PM
Hi Joni,
that works! Submit goes through without that alert and user is redirected to the URL I set. Thanks!