Redirect to Homepage after survey is complete

Mark Endsley
Tera Guru

We are upgrading to San-Diego, which comes with a new Survey Widget.

I had modified the old widget where it would redirect the user to the Portal Homepage after the survey was finished. 

Before I go to modify the new widget, I'm trying to find out if there is any better way to accomplish this.

find_real_file.png

 

What we want is it to redirect at this point. Right now in the new widget does not (although the link still works).

 

I've tried putting 

<meta http-equiv="refresh" content="0; URL=/sp" />

 

Into the HTML field that houses the text in the survey. It wouldn't even save it that way. I also tried:

 

        <script type="text/javascript">
            window.location.href = "/sp"
        </script>

 

Same thing, the HTML field would not have any of that.

 

I'm really hoping there is some way to accomplish this without having to modify the widget. While I'm willing to do it, it seems like such a small thing to do that over.

 

I also can't find any instance options or anything in the code of the widget where it looks like I could feed this in.

 

Any ideas?

1 ACCEPTED SOLUTION

Cuong Phan
Kilo Sage

Hi Mark,

 

If you can inspect the submit button, you can build a widget (only have the listener of the button). In the client controller, add the click event and set some timeout for that, so it will redirect after the button is submitted.

 

Mark Correct if this solves your issue and also mark ???? Helpful if you find my response worthy based on the impact.

 

Cuong Phan

Senior Consultant.

 
Regards,
Cuong Phan
ServiceNow Technical Lead

View solution in original post

3 REPLIES 3

Cuong Phan
Kilo Sage

Hi Mark,

 

If you can inspect the submit button, you can build a widget (only have the listener of the button). In the client controller, add the click event and set some timeout for that, so it will redirect after the button is submitted.

 

Mark Correct if this solves your issue and also mark ???? Helpful if you find my response worthy based on the impact.

 

Cuong Phan

Senior Consultant.

 
Regards,
Cuong Phan
ServiceNow Technical Lead

Hi Cuong,

 

I like this idea. How can I access a button within another widget in my widget?

Ok.. Here is what I came up with....

 

 angular.element($window).on('click', function(event){
	 
	 if(event.target.innerText == 'Submitting...' && event.target.localName == 'button'){
			$window.location.href = "/sp";
	 }
	 
 });