Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to preview attachment in the new tab from Workspace

nachanon_m
Tera Contributor

Hello everyone,

Is there a use case or configuration for the Workspace's Attachment panel that allows the preview page to open in a new tab of the current browser?

 

Current Behavior

- When you click on the attachment, the Workspace displays the document viewer tools on the same page without changing the URL.

nachanon_m_0-1723565243552.png

nachanon_m_1-1723565359175.png

Expected Behavior

- The document preview page opens in a new tab in the browser when you click on any attachment in the Workspace.

nachanon_m_2-1723565658877.png

 

What Solution I've tried

- I created a new Action Assignment (Attachment action) to add a custom button in the action area, but it's not working because I can't retrieve the sys_id of the attachment from the Action Assignment, either in the client or server script, to open it in a new tab.

nachanon_m_3-1723565814976.png

- I edited the Attachment components in the UI Builder to add a custom event when a user previews an attachment. This seemed to be the closest way to achieve my goal, but I still couldn't retrieve the sys_id of the clicked Attachment component. There's no payload indicating which attachment the user is trying to preview, so I can't open anything in a new tab.😔.

nachanon_m_4-1723566090167.png

@Brad Tilton 

Any suggestions or ideas? Or is this the default behavior of the Workspace, meaning I can't change it?

Thank you.

1 ACCEPTED SOLUTION

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

If you implement the action as a UXF Client Action and give the action new payload definition record a key of NAV_ITEM_SELECTED and a payload something like below, it should work.

 

{
    "external": {
        "url": "/sys_attachment.do?sysparm_referring_url=tear_off&view=true&sys_id={{attachmentSysId}}"
    }
}

 

ArnoudKooi_0-1723759328184.png

 

 

 

View solution in original post

7 REPLIES 7

nachanon_m
Tera Contributor

Any help please @Alisa Tipisova 

Niamul Arifin
Tera Expert

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

If you implement the action as a UXF Client Action and give the action new payload definition record a key of NAV_ITEM_SELECTED and a payload something like below, it should work.

 

{
    "external": {
        "url": "/sys_attachment.do?sysparm_referring_url=tear_off&view=true&sys_id={{attachmentSysId}}"
    }
}

 

ArnoudKooi_0-1723759328184.png

 

 

 

Hi, thank you, this solved the issue for me and Preview works as expected. Just one more thing - is it possible to do the same for Activity component?

1328d4323bc1d694d54f690eb3e45a5f (1).png