In our AX 4.0 environment we've got a customization on our EP which provides original document scans as PDF files available for download, via a custom field which identifies the network path of the file. Providing the file to the user is done through the .layout() method on the WebForm for the EP page using the following code:
if (custInvoiceJour.CustomFileField)
{
link.menufunction(new WebUrlMenuFunction(weburlitemstr(EPDocuGet)));
link.record(custInvoiceJour);
link.parm("ImageFile");
html += '<a href="';
html += link.url();
html += '" border=0>';
html += '<img align="middle" border=0 alt="'+"@SYS12229"+'" style="margin-left: 2; margin-right: 2" src="' + WebImageWeblet::ImageRunSource('WebIcon_Document') + '">';
html += '</a>';
}
webSession().writeTxt(html);
In my new 2012 environment I would like to implement a similar customization, providing a link to the files in a similar fashion, but instead of using a WebForm the page is now being deployed as a ListPage using the "Deploy to EP" feature. The ListPage template doesn't allow adding code in quite the same way, so I've got an Action MenuItem linked through the ActionPane, and pointing to a class which I would like to initiate the download. So when a user has a row selected and clicks on the button that triggers this MenuItem (and therefore the class) the file download will begin.
Is there a way to accomplish file downloading in this way, or is there a better way to allow local resources to be downloaded?
Thanks!
Dan