Getting attachment id in attachment action client script

Sebastian Kring
Tera Contributor

Hi everybody,

 

I have been struggling with an issue that is driving me crazy. Our customers want attachments to be opened in a new browser tab by default when they are being clicked on in a case / task record in CSM/FSM workspace. By default the document viewer shows up, overlapping the whole screen.

This does not seem to be possible.

 

Now since Vancouver, there is the option to define attachment actions (All > Workspace Experience > Actions & Components > Attachment Actions).

I have been trying to define an action that can be selected via the attachment context menu that helps agents open the attachment in a new tab:

Screenshot 2023-12-06 at 16.49.24.png

Creating an action is easy. However, I do not get a hold on the attachment's sys_id in the client script. The predefined script provides nothing but the empty click event listener but no hints on available objects:

function onClick() {

 }

If I had the attachment's sys_id I could do something such as

top.window.open("<instance_name>/sys_attachment.do?sys_id=<attachment_sys_id>" target="_blank")

Any ideas?

Thank you very much for your help!

6 REPLIES 6

mohit_ra
ServiceNow Employee
ServiceNow Employee

Hi @Sebastian Kring , did you get any solution for this?

Sebastian Kring
Tera Contributor

Hi mohit_ra,

 

unfortunately not yet. I will keep this post updated as soon as we find a solution

Benjamin JS
Tera Contributor

@Sebastian Kring @mohit_ra Did you find a solution to this? I have the same requirment, but can't seem to pull the sys_id in any way

Sebastian Kring
Tera Contributor

Hi Benjamin,

 

unfortunately not. I ended up with the workaround to add a ui action which opens all attachments of certain file types in new tabs.