OnSubmit Page Redirect using GlideNavigation

Austen Harriso1
Tera Contributor

Been trying to get an onSubmit script for a catalog item to work where the user is redirected to the home page after submitting the record. We recently created a record producer for a new table, and the user is defaulted to the standard portal ticket form. We would like to instead redirect the user to our homepage (/sp) and have created an onSubmit client script utilizing the GlideNavigation API class. However, even with the script, the user is still defaulted to the ticket form. I suspect it may have something to do with the Portal or the widget, but I haven't been able to verify.

Here's the code I'm using:

function onSubmit() {

  //Redirects the user to the homepage

  alert('Thank you for your feedback!');

  g_navigation.open('https://#######.service-now.com/sp','_self');

}

Does anyone know of any potential issues here? Has anyone had any luck with onSubmit redirect scripts?

Thank you!

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi,



Please see solution for redirection on below post.



Helsinki Service Portal - Record Producer Redirect



Regards,


Sachin


View solution in original post

2 REPLIES 2

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi,



Please see solution for redirection on below post.



Helsinki Service Portal - Record Producer Redirect



Regards,


Sachin


Awesome! Modified the widget SC Catalog Item under the "issueMessage" function. Now the item redirects properly to the Portal homepage. Unfortunate that it can't be easily controlled through a client script, but I'm glad to get it working.



if(table == 'xxxxxx') {


  if (c.options.auto_redirect == "true") {


  $window.location.href = '/sp';


  return;



Thanks Sachin!