window.location.href alternative script for scoped app

MaharshiC
Tera Contributor

Hi,

 

I have created a related list action in scoped app and is using the folowing code but window.location.href is not working. Can somebody give me the alternative code that I can use here?

function onClick() {
alert('This is a simple alert message!');
var a = window.location.href;
alert('newThis is a simple alert message!');
alert('abc'+a);
1 ACCEPTED SOLUTION

Ramya Neelam1
Tera Guru

Hi MaharshiC,

 

You can try with this 'top.location.href'.

 

Thanks

Ramya.N

View solution in original post

8 REPLIES 8

@MaharshiC You can utilise glide.script.block.client.globals system property and set it to false but again it is not a recommended solution due to it applying on all the scoped applications. Here is a support article around this property https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0551586

maheshkhatal
Mega Sage

@MaharshiC  window.location.href does not work ,I faced the issue long time back.

Please refer the suggestion in the link given below.

Window.location.hred in scopped App 

Accept this as solution and mark my response as helpful.

Thank you,

Mahesh.

Martin Friedel
Mega Sage

Hello,

 

you can try to create a new system property in System Properties table [sys_properties] within your Application scope:

Name: glide.script.block.client.globals

Value: false

 

Now you should be able to access DOM in your scoped Client Script.

You can find more informations in this article: Scoped Applications and Client Scripts: A Primer 

 

If my answer helped you, please mark it as correct and helpful, thank you 👍
Martin

Ramya Neelam1
Tera Guru

Hi MaharshiC,

 

You can try with this 'top.location.href'.

 

Thanks

Ramya.N