How to download attachment in same window

Community Alums
Not applicable

Hello Team,

There is one attachment variable in the record producer  

when the user clicks on the hyperlink(Download template here), the template gets downloaded (the form remains opened), no additional tabs should appear.

 

mayshinde_0-1729578973060.png

 

 

 

1 REPLY 1

Akash4
Kilo Sage
Kilo Sage

Hello,

From SN OOB, the attachment variable always opens in a new tab since it’s designed to download or view the attachment. Since loading in current page might reload the form or pop up with “changes you made will be remoed”. 

However, Customization is possible, but it depends on how important the use case is.

Try out this Client script onLoad:

function openAttachmentInSameTab(attachmentSysId) {

attachmentSysId = xyz //get this via a new ScriptInclude (GlideAjax call) > getRecentSysID based on orderByDesc(‘sys_created_on’) with setLimit(1) on the Attachment table.
var attachmentURL = '/sys_attachment.do?sys_id=' + attachmentSysId;
window.location.href = attachmentURL; 
}

This is an overhead to the system, but depends on customer requirements.

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.