Applies to version 2016.1.x; Author: Mariusz Burek
How to add attachment download links to your SWE Web Parts?
Calculated columns on the SWE Web Part offer virtually limitless possibilities to the user configuring them. One such capability is creating a column on the SWE report, which contains links to the last added attachment for each workflow instance.
Configuring a calculated column in this way is particularly useful in scenarios where the most important component of a workflow instance is a file attached to it. Whereas the workflow itself is used primarily as a means to organize those attachments, and offer additional methods of searching and sorting workflow content.
In order to create a link to an attachment on the SWE report, add a calculated column (SWE configuration -> Data selection -> Add calculated column). In the popup window (Fig. 1.) set the type to “Link” and enter the following query:
(select top 1 'link:/_layouts/15/webcon/ImageHandler.ashx?ATT_ID='+cast(ATT_ID as varchar)+';displayname:'+ATT_Name
from WFDataAttachmets where ATT_WFDID = WFD_ID order by ATT_ID desc)
NOTE! The parentheses were added purposefully and should not be removed.
Fig. 1. Configuration of a calculated column
After saving the configuration for the SWE Web Part and returning to the form, a user should be able to click the contents of the new column. This will cause a download confirmation message to appear (Fig. 2.):
Fig. 2. Saving an attachment from the SWE Web Part