How to download attachment(sys_attachment) in workspace

shun6
Giga Sage

Hi developer,

I added "Attachment" related list on catalog task record so that user can download files.

When I click on the File name on the Platform UI form file is downloaded, but on the Workspace UI form file cannot be downloaded and open the sys_attachment record.

How can I download attachment(sys_attachment) on Workspace UI? 

shun6_0-1727162704364.png

 

Regards,

2 REPLIES 2

thullurishalini
Kilo Guru

Hi developer,

To enable downloading attachments directly from the Workspace UI, you can customize the behavior using a Client Script or UI Action. 

  1. Create a UI Action:

    • Navigate to System Definition > UI Actions.
    • Click New to create a new UI Action.
    • Configure the UI Action to download the attachment.
  2. Script for UI Action:

    • Use the following script to handle the download:
    function downloadAttachment(attachmentSysId) {
        var ga = new GlideAjax('AttachmentAjax');
        ga.addParam('sys_id', attachmentSysId);
        ga.getXMLAnswer(function(response) {
            var answer = response.responseXML.documentElement.getAttribute("answer");
            window.location = answer;
        });
    }
  3. Add UI Action to Workspace:

    • Ensure the UI Action is available in the Workspace by adding it to the appropriate form or list layout.

This approach allows users to download attachments directly from the Workspace UI without navigating to the sys_attachment record.

 

 

Thanks ChatGPT..