- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 10:18 PM
I have changed the download link for attachments to "View".
However, files with the "zip" extension cannot be viewed and are instead downloaded.
I understand this specification because it is stated in the product documentation.
However, it is not so good that they are downloaded even though they are "View".
Is it possible to hide the "View" link for "zip" files?
Or I would like to change it back to "Download"
If you can disable the link, that's fine too.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 02:08 AM
you will have to manipulate that using DOM manipulation and hide the view word
Note: DOM manipulation is not recommended
This onLoad script worked for me. Ensure "Isolate Script" = False for your client script
If this field is not on form then from list make it False
You can enhance it for other file extensions as well
function onLoad() {
//Type appropriate comment here, and begin script below
setTimeout(function() {
// Get all elements with the class 'attachment_list_items'
document.querySelectorAll('.attachment_list_items').forEach(function(item) {
alert('inside');
// Find all anchor tags within this item
var anchors = item.getElementsByTagName('a');
// Check if any anchor's aria-label or innerText contains 'zip'
var hasZip = Array.from(anchors).some(function(a) {
// Check for filename in aria-label or innerText
var text = (a.getAttribute('aria-label') || '') + (a.innerText || '');
return text.toLowerCase().includes('zip');
});
if (hasZip) {
// Hide 'view' anchor tags within this item
Array.from(anchors).forEach(function(a) {
if (a.innerHTML && a.innerHTML.toLowerCase().includes('view')) {
a.style.display = 'none';
}
});
}
});
}, 2000);
}
Output: 2 files were zip so View was removed from them
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 10:49 PM
Hello @bonsai,
You can refer below links for this requirement:
https://www.servicenow.com/docs/bundle/yokohama-platform-administration/page/administer/form-adminis...
https://www.servicenow.com/community/sysadmin-forum/about-the-dictionary-attribute-quot-use-document...
Please mark my solution as helpful and accepted for future reference.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 11:27 PM
Thank you.
I learned from this article which file extensions are supported and that clicking the "View" link on a zip file will download it.
What I want to know now is whether it is possible to hide the "View" link depending on the file extension.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 02:08 AM
you will have to manipulate that using DOM manipulation and hide the view word
Note: DOM manipulation is not recommended
This onLoad script worked for me. Ensure "Isolate Script" = False for your client script
If this field is not on form then from list make it False
You can enhance it for other file extensions as well
function onLoad() {
//Type appropriate comment here, and begin script below
setTimeout(function() {
// Get all elements with the class 'attachment_list_items'
document.querySelectorAll('.attachment_list_items').forEach(function(item) {
alert('inside');
// Find all anchor tags within this item
var anchors = item.getElementsByTagName('a');
// Check if any anchor's aria-label or innerText contains 'zip'
var hasZip = Array.from(anchors).some(function(a) {
// Check for filename in aria-label or innerText
var text = (a.getAttribute('aria-label') || '') + (a.innerText || '');
return text.toLowerCase().includes('zip');
});
if (hasZip) {
// Hide 'view' anchor tags within this item
Array.from(anchors).forEach(function(a) {
if (a.innerHTML && a.innerHTML.toLowerCase().includes('view')) {
a.style.display = 'none';
}
});
}
});
}, 2000);
}
Output: 2 files were zip so View was removed from them
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader