The CreatorCon Call for Content is officially open! Get started here.

Need to redirect to a new URL on a change Script not working

Luis Roman
Kilo Guru

I have the script below that I use on an Onchange in a scope application. However, the script is not working. Any feedback? Looks like window is not supported according to Service Now but do not know what I need to replace it in order to trigger the redirect URL? Help appreciated. 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'SNOW access request')
var redirectURL ='https://snedge-lmscdev026.external.lmco.com/service_central_portal?id=sc_cat_item&sys_id=e661fb491b84cd90687365ffe54bcb6d&sysparm_category=5c1980c1dbe37b40ca073efd7c961927';
top.window.location = redirectURL;
}

 

Luis Roman Lockheed Martin 

 

1 ACCEPTED SOLUTION

Shakeel Shaik
Giga Sage
Giga Sage

Hi  @Luis Roman 

 

top.location.href = redirectURL;

 

Please check and let us know.

 

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

View solution in original post

4 REPLIES 4

Sebastian L
Mega Sage

this should do the trick if it is on the portal:

location.href = redirectURL;

 

 


Best regards,
Sebastian Laursen

Shakeel Shaik
Giga Sage
Giga Sage

Hi  @Luis Roman 

 

top.location.href = redirectURL;

 

Please check and let us know.

 

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

Shakeel Shaik
Giga Sage
Giga Sage

Hi @Luis Roman 

 

similar question, Have a look

window.location.href is not working in Client Script

 
 
 
Thanks,
Shakeel Shaik 🙂

Luis Roman
Kilo Guru

THank you all for the guidance. Now that the script is working I am getting a save message before the redirect. Is there any script command that I can add to hide the message?