Redirect to the top frame using SendRedirect function

kc99
Giga Expert

Hello,

we have a survey that we present to the user in an iFrame on one of our CMS sites.

We have entered a 'Redirect URL' on the survey definition so that, on submission of the survey, the user is redirected to a 'thank you' page via the processor script within the ui page 'assessment_take2'.

This works ok BUT the 'thank you' page is loaded into the iframe part of the survey page which, because of the way iframes work, positions the focus on an area of white space and you have to scroll up to see the thank you message.

Are there any parameters to the SendRedirect function that would allow me to load the thank you page in the TOP frame and not in the same iframe that the survey sits in?

I can't find any useful references to SendRedirect on the wiki so I'm hoping the experts can help,

many thanks in advance,

Keiron.

4 REPLIES 4

Gurpreet07
Mega Sage

try to pass the complete url as parameter and do not use nav_to.do in it. Following format of link



https://instance_name.service-now.com/uiPageName.do


Hi Gurpreet,



thanks for taking the time to answer.



The survey definition will not allow a full http address and will only allow a relative address (using './' or '/') as the prefix,



thanks,


Keiron.


Not in the survey definition but in   sendRedirect function accept any url. I tested below in processing script of a ui page.


(function(_this) {


  var url = 'https://google.com';


  //gs.addInfoMessage('processing');


response.sendRedirect(url);



})(this);


Thanks again Gurpreet.



We can't add the full URL directly to the processing script because we have several different surveys for several different customers which is why the 'Redirect URL' needs to be added to the Survey Definition.



We tend to direct them to a page on their CMS (ESS) site in preference to a stand-alone survey as they are familiar with the layout.



But to prove the point I've tried entering the full URL as in the example below but it still directs to the iframe...



if (selection_result == 'submit') {


  var type = new GlideRecord("asmt_metric_type");


  type.get(type_sysID);


  var url = type.url;


  if (!type.url)


    url = 'https://xxxxx.service-now.com/zzzzz/assessment_thanks.do?sysparm_assessable_type=' + type_sysID.toString() + '&sysparm_assessment_type=' + type.evaluation_method.getChoiceValue().toLowerCase();


  response.sendRedirect(url);


} else {


  var type = new GlideRecord("asmt_metric_type");


  type.get(type_sysID);


  var url = 'https://xxxxx.service-now.com/zzzzz/assessment_take2.do?sysparm_assessable_type=' + type_sysID.toString() + '&sysparm_assessable_sysid=' + selection_result + '&sysparm_assessment_type=' + type.evaluation_method.getChoiceValue().toLowerCase();


  response.sendRedirect(url);


}