Service Portal Submit & Redirect [Madrid] - ServiceNow Community
Mark Roethof
Tera Patron
Tera Patron

Hi there,

A short article to share gained knowledge about submitting Catalog Items on the Service Portal and the auto-redirect which is happening after the submission of the Catalog Item. What if you don't want to have an auto-redirect?!

No need to trash the SC Catalog Item widget and design something custom. After investigating the out-of-the-box SC Catalog Item widget, I noticed that in the Client Script of the widget, c.options.auto_redirect is being used. Looking at the widget options schema though, no such option available. So what if we just add that option to the option schema... works like a charm 🙂

1) The redirected page after submitting the Catalog Item

find_real_file.png

2) Edit the option schema for widget SC Catalog Item

find_real_file.png

3) Add a new option, name should be "auto_redirect"

find_real_file.png

4) On the Service Portal, within a Catalog Item, ctrl right click on the Widget and select Instance Options 

find_real_file.png

5) Leave the auto_redirect option unchecked

find_real_file.png

6) The end result... no redirect after submitting a Catalog Item

find_real_file.png

---

And that's it actually. Hope you like it. If any questions or remarks, let me know!

👍
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful.

Interested in more articles, blogs, videos, and Share projects on Service Portal I published?
Service Portal


Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn

Comments
margie_joyce
Kilo Contributor

Hi Mark,

Does doing this then stop the auto redirect for ALL catalog items?

I am trying to find a solution for a single catalog item, where, dependent on what the user selects in a variable, I either auto redirect as normal, or redirect to a knowledge article (which article is dependent on variable value).

Use case is user requesting password reset. For some applications, service desk needs to action, so need to create and submit request, and auto redirecting to the created request is fine.

For other applications, the user can self-reset the password, with different instructions (different KB article) for each of the systems. When the user submits, a request is created (and completed) and the user is redirected to the applicable article.

Just wondering if you had any ideas?

 

thanks.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Yes this is for all items and yes what your describing would be possible to build for individual items, though you have to edit the widget a bit more (there are actually already examples to start with, within the widget. look at the mandatory attachment part for example, oke not complete but it could give a headstart) + add a field to the Catalog Item form lay-out on the Platform UI which has the choices you would prefer.

Be aware that when changing the widget (you actually have to clone it), you're cloned version won't be updated with new things from patches/upgrades. Not always an issue, but like in London/Madrid some real changes have been made (multi row variable set, attachment mandatory/hidden, etc.).

Just post a question on the community about achieving this functionality. Lots of community members willing to have a look or if I have time I might up looking at it myself 🙂

Kind regards,
Mark

---

LinkedIn

mleighton
Kilo Expert

Hey Mark,

Is there a way, via the options, to redirect to homepage instead of staying on the same page?

Also, it looks like that is a cloned widget. Is that correct?

Thanks

Mike

Astridkm
Giga Contributor

I'm wondering about this as well, about how to redirect to another page of my choosing.

Thanks.

mleighton
Kilo Expert

Hey,

The Page Route Maps module is where I was able to make this happen.

Thanks,

Mike

Rich7
Tera Expert

Have anyone tried using this disabling the auto_direct in London?   When I tried, it just keep me on the same page with a message saying "Submitting..."

agrawars
Tera Contributor

I cloned existing SC Catalog Item widget and added similar option like deprecated one.

find_real_file.png

 

Modified existing function getOne() like below

1)

find_real_file.png

2) 

find_real_file.png

 

Last function needs to modify is formatRedirectURL()

find_real_file.png

This solution is working fine and it can redirect to your page of choice, but I am not sure if this is the best way to achieve it.

 

 

Version history
Last update:
‎04-16-2019 01:31 AM
Updated by: