
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 02:35 PM
I have a workspace that users use to open "Appeal" records. Each one of these records has 1+ attachments on it. The user has to open the attachment and pick out data that needs to be recorded on the record. The attachments are usually PDF's and then come in all shapes and sizes. The default Attachment sidebar tab stinks for this kind of work because the attachment opens over the record you need to enter the data. So we build a new sidebar tab that shows all of the attachments and when you click on them they open in a new tab. We would like them to open in a new window.
I used the Event "Link to destination" to open the URL but that opens it in a browser tab and we need a new window.
I tried using a client script and "window.open", "this.window.open" and "document" and all come up as undefined.
I even tried a Client Script Include and that did not change anything.
Has anyone needed to do this and managed to figure it out?
Anyone have any thoughts on other things to try I'm all ears.
Please and thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 10:50 PM
Hi @DrewW
please check if the answer given at https://www.servicenow.com/community/developer-forum/is-it-possible-to-get-dom-element-via-client-sc... might help you to access the browser objects.
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 07:23 AM
I saw that one and when I do
console.log(this);
I get null and I get
TypeError: this is null
when I do console.log(this.window) or console.log(this.document)
But as I type this I realize I did not try
helpers.timing.setTimeout(function() {
console.log(this.window);
});
Which does turn out to work, which is frustrating.
Thank you for posting that again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 10:50 PM
Hi @DrewW
please check if the answer given at https://www.servicenow.com/community/developer-forum/is-it-possible-to-get-dom-element-via-client-sc... might help you to access the browser objects.
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 07:23 AM
I saw that one and when I do
console.log(this);
I get null and I get
TypeError: this is null
when I do console.log(this.window) or console.log(this.document)
But as I type this I realize I did not try
helpers.timing.setTimeout(function() {
console.log(this.window);
});
Which does turn out to work, which is frustrating.
Thank you for posting that again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2025 03:34 AM
Hi,
i have the problem you mentioned before: when the user clicks on the attachment it should be opened in new tab (not in new windows which was your case).
Can you please tell me how did you do that? How can i create new sidebar to generate those attachments?
Please and thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:19 AM
You have to user UI Builder to customize the Record page you are using and add an option to the Tab sidebar. Which means you also have to add a data source to get the list of attachments and then add whatever components you want to use to display the attachment info and eventually something to click on to run the code to open the attachment in a new tab/window.