Hi All,
We have a custom entity called Documents which is used to store attachments of various formats (PDF, Word, txt, etc.). There is a custom iFrame on our Dashboard which displays grid of these document records. Now we need to allow the user to download the document attachments directly from this grid without opening the individual Document record and then click on the attachment file. The custom iFrame grid will have a Download button, clicking on which should download the attachment directly in browser.
My initial thought was that this implementation would be similar to how we open any form, view, dialog or report in CRM (by generating a dynamics URL) but it doesn't look that easy for attachments. Kindly provide your inputs on this.
Note:
1. I found this article on MSDN which discusses downloading attachment via plugin code. One option I can think of is to have similar logic written in a custom Action via code and call this Action when the Download button is clicked.
*This post is locked for comments
Hi Ashish,
I have a similar requirement. I have to show the notes attachment(pdf, excel, word) in an iframe on the form.
Could you guide how we can display the pdf or excel in iframe and if it is possible?
Thanks all for your inputs. For any future references coming to this thread, I took the approach of querying the 'annotation' entity from Javascript using WebAPI. This WebAPI query will fetch the 'documentbody' and 'mimetype' attributes of the 'annotation' entity record which can then be parsed in Javascript to render it on client browser as the actual document (PDF, Word, etc). This solution works well for both browser and iPad versions of CRM.
Note that although I implemented this functionality on Javascript side, it can be achieved on the similar lines from C# code by querying the 'annotation' entity and parsing the results.
There are some resource available. You can refer to this to see if it helps.
mahadeomatre.blogspot.com.au/.../view-or-download-attachments-for.html
Hey Alex.. I am not sure whether this solution would work for all kind of attachment formats and all devices.
Any inputs on the Action approach?
Hi,
you might try this:
community.dynamics.com/.../downloading-dynamics-crm-attachments-with-javascript
I'm not sure if it's fully "supported" because attachments have never been fully supported on the scripting side in Dynamics, so use at your own risk
EDIT: Just realized there is a missing download.js library there, so I'm not sure you can use it as is
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156