window.open written in a client script and its not working on Service Portal

prabh
Mega Expert

Hi Folks,

I have a catalog item and in that there is onchange client script which opens different URLs based on the value selected using window.open() function.

But this script is not working on Service Portal. I have changed the UI type of the script to "Both" as well.

Please help.

Thanks

Preety Arora

23 REPLIES 23

I have done the same and my application was Global. But still facing the same issue.


Can you send me a screenshot of the client script form and the property that you have sent. I think the error might be something very subtle.


if(g_form.getValue('issue_name') == "Restore issue")


  {


alert(window);   // this is returning null


top.window.location.href = "xxxxxxx";       // this is working but opening in same page.


window.open("xxxxx");     // not working


}


find_real_file.png


Upload a screenshot of the entire client script form.


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Preety,



It looks like Service Portal is blocking many globals from client scripts, but allowing top. I tested the following in a catalog client script rendered in service portal in my instance and was able to open a new window:



top.window.open('xxxxx', '_blank');