A link to an attachment from where the user should open the file and view it directly

Aerial Reptile
Giga Expert

Hi there!

 

I have a UI page from where I must provide a link to open the file which was attached in the ticket (excel, pdf etc.). When I do the following-

<a style="color:blue;display:inline;" target="_blank" href="https://mydev.service-now.com/sys_attachment.do?sys_id=${attachment.sys_id}">View File</a>  
where ${attachment.sys_id} is the attachment sys id and it is dynamically set,
it creates a link which downloads the file directly.
 
I don't want this to download the file but instead I'd like for it to open the file directly.
 
Any ideas how this can be achieved?
 
Thanks in advance!
-A.R.
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Aerial Reptile 

Also check this

1) enable document viewer plugin

2) enable it for your table

Enable Document Viewer 

Then you can use the view=true in URL

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Aerial Reptile
Giga Expert

Thank you for your replies!

 

It works fine for a few files as mentioned by Robert above.

However for other files, it goes straight to downloading the file.

I was wondering if we can utilize live officeapps viewing to view the file instead of downloading. Let me know if you've tried it.

 

Thank you!

-A.R.

@Aerial Reptile 

Did you try to use the document viewer?

1) enable document viewer plugin

2) enable it for your table

Enable Document Viewer 

Then you can use the view=true in URL

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader