Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Cannot access window object from UI builder Page scripts

murtuzababuji
Tera Contributor

Hello all,

I have a scoped application and I have developed a page using UI builder. On a button click I need to download a file from Attachments. I have added a event handler to a Page script to fetch attachment sysid. Now I just need to use window.open to download the file using the '/sys_attachment.do?sys_id=someid' URL. Issue is that window is undefined in the UI builder page scripts. I even tried setting the glide.script.block.client.globals as per this KB0551586 to no avail. What am I missing? Is there an alternative to using window.open?

1 ACCEPTED SOLUTION

Jesalyn S
Kilo Sage

Hi murtuzababuji,

 

I've been able to use the solution in this community post: https://www.servicenow.com/community/developer-forum/is-it-possible-to-get-dom-element-via-client-sc... in order to access the window object in page scripts.

 

Hope this helps!

View solution in original post

2 REPLIES 2

Jesalyn S
Kilo Sage

Hi murtuzababuji,

 

I've been able to use the solution in this community post: https://www.servicenow.com/community/developer-forum/is-it-possible-to-get-dom-element-via-client-sc... in order to access the window object in page scripts.

 

Hope this helps!

This worked perfectly. Thanks a lot.