Knowledge Article attachments are downloaded instead of opening in the browser. How can I change this behavior?

Abhinav4
Kilo Contributor

Knowledge Article attachments are downloaded instead of opening in the browser. How can  I change this behavior?

8 REPLIES 8

Lauren Methena
Giga Guru

Hi, Abhinav! 

You can code attachments as URLs instead of as attachments using either the link tool within your content tools or using the HTML coding in the source code.

Please see the attached PDF resource. (Some of it is a bit specific to our organization, but the steps for the hack I found work. You'll find directions for both ways - as an attachment and as a URL.)

Also, please see this thread I participated in not too long ago. There's some additional info here that might help.

https://community.servicenow.com/community?id=community_question&sys_id=e597ef9f1b23a4101e579979b04b...

If you find this info and this guide helpful (or even correct for your needs), please mark my answer as such so others will know it's legit. šŸ˜‰

Good luck! Please let me know if you have additional questions!

Lauren

Hello Lauren,

Thanks for the workaround. It may work when we create a new KB article. But we already have thousands of KB articles and some of these articles have attachment. Kindly check my reply in the response below that we don't want attachment to be downloaded but opens in the browser. 

The only way I know to fix all those links is to fix them in the HTML coding - either using the workarounds in the guide I attached or going straight into the code, depending on your coding skills.

The only other thing you might be able to try is writing and running your own script to make mass changes across articles. We've not tried this in the content yet, so I don't know exactly how it would work, but it's worth looking into.

If you look at the URLs that are used for your attachments, they all have "attachment" in them and some other unique identifiers that separate them from regular URLs that link to other articles or websites.

You also have to make sure a document/PDF viewer is enabled in your instance. (I am not the admin for our group, so I don't know a lot more than that - someone else may be able to provide more details. I also posted about it in another thread early on. This link may provide some info: https://community.servicenow.com/community?id=community_question&sys_id=fbeff570db475c54fa192183ca96.... There is also more info in the comments to this article.)

In the meantime, when your document viewer is enabled, it automatically turns attachments into PDFs viewable in a web browser. When you have it coded right, the attachment URL will end with "&view=true".

That being the case, you may be able to run some sort of script with the logic that all URLs that contain "[whatever identifier makes the most sense for you for your current attachments]" > add "&view=true" to the end of the URL. In doing so, you may be able to change the coding en masse.

You could try customizing your knowledge article widget to default all attachment links to open in a new browser tab as a PDF, but I feel like long-term, that could come back to bite you.

Hope this gives you some ideas! Let me know if this leads you on the right path or not.

-Lauren

 

shannont
Giga Guru

Hi Abhinav,

You want to ensure that Attachment Link is not checked in the Meta Data of the article.  That tells the system that you want the attachment to automatically download when a user clicks on that article.  Instead, you want to check Display Attachments which allows the user to read your article and be guided to open the attachment if needed.