Drag n Drop Upload Control for Dynamics CRM 2013


Almost a year ago I was working on a PoC to demonstrate Microsoft Dynamics CRM 2011’s amazing new capabilities. One of the requirement of the PoC was to showcase drag-n-drop upload of documents. I wanted to deliver a quick PoC hence the code doesn’t handle all the scenarios, but it will give you a basic idea of how to provide such a feature on any of CRM Entity Forms. Also I have migrated the script to work with Dynamics CRM 2013.

Features

  • Simple to setup
  • Handles basic validations
  • Refreshes the Notes control after files are uploaded
  • Tested with Dynamics CRM 2013(Will work with Dynamics CRM 2011 with minor changes in the script)

Setup Instructions 

  • Download the solution from here.
  • Import the solution in your CRM Instance where you would want to enable this functionality
  • Open the Entity form in From Designer Mode
  • Insert a Web Resource and point it to the Main.htm file as shown below:

 

  • Click on Ok. Save and Publish the Form.
  • Navigate to form and you will see an area on the form as shown below(depending upon how and where you have placed the upload control this may vary):
  • If there is any validation failing a message will appear under the drag and drop area.
  • Enjoy!!!

For those who are interested in details this control can save you minimum 6 clicks. I am sure anyone from Telco/Contact Center background would know how less number of clicks means more revenue/or less investment. Please note that I do not take any responsibility whatsoever for the solution published. Use it at your own risk. On the other hand if you find any challenge implementing this solution, do leave me a comment and I will try to help.

Comments (32)

  1. Patrick says:

    Impossible to import: Invalid XML code

  2. Jan says:

    This does not work with CRM 2015 because you are using "getServerUrl()". Changing the code to use Xrm.Page.context.getClientUrl() would work.

  3. Vince Lopiccola says:

    Will it work with CRM 2015?

  4. Krishna Shahapur says:

    Super, feeling happy yo work on this solution.

  5. Muhammed Rafi says:

    Hi, I tried the steps you mentioned above. Im using CRM 2011 and in the form customization I inserted as the webresource  and published, but when I come to view of the form it is not showing anything..

    Is this supported in CRM 2011?

    Please help

  6. bhavusuresh says:

    hi….while importing the solution it shows some error..CRM List of possible elements expected Is Customizable Can Be Deleted Is Hidden….et.c,etc., any help..the file upload is very important and reqd control…for us…pls help

  7. First of all, I am really sorry for responding so late to your comments.

    @Jan: Thanks. I am publishing a better version on CodePlex soon and shall fix it.

    @Vince: As mentioned by Jan, it will not work with Dynamics CRM 2015.

    @Muhammed: To make it work with CRM 2011, you have to make some changes in it. The original version targeted CRM 2011 only but this version targets CRM 2013(at the time of writing this post Dynamics CRM 2013 was the latest version).

    @Bhavusuresh: Could you please provide more details on the environment you are using and Dynamics CRM version as well?

  8. Ram says:

    this is disable while creating records.it is working after saving that if you open again it is working

    please tell me how to enable that while creating also

  9. Ram: That is by design. When a record is not saved, you can not add notes to it.

  10. sushil says:

    Hi, when we drag and drop multiple files, there is an error, invalid XML, this is not because of the XML file attachment, but we are trying to drag and drop multiple items at one go. would u know why ?

  11. Hi Sushil,

    Could you please post more details like your environment and maybe a link to the screenshot?

  12. As promised, the updated version is available at: crmdragndrop.codeplex.com

  13. Had-Jay says:

    Hi I have added your updated web resource to one of our forms in CRM 2015 and it is showing the message "Upload is disabled for this form type". Do you have any more information about this error?

  14. Hi Had-Jay,

    That is not an error message. This control doesn't work if the record is not already created i.e. when you are creating the record it will not allow you to upload files.

  15. ramzy says:

    Hi,

    i darg 2 files in the email form , i have the message :  

    Processing crm.txt

    Uploaded crm.txt Successfully.

    but when i refresh or i save my form this file i can't find it anywhere

    any idea ?

  16. Frank says:

    You could always change the js message in the solution from "Upload is disabled for this form type." to something like "Please save your record before uploading files." to try to idiot-proof this for end users… "save THEN attach, otherwise there's nothing to attach things TO" still confuses many of my users 🙂

    Chinmay – this is excellent, many thanks!

  17. Hi Ramzy,

    This particular control uploads files to Notes only. If you want email attachments then check crmdragndrop.codeplex.com

    Hi Frank

    Thank you very much for you comments. And about changing the message, consider it done in a next release. Also please note that I have upgraded the entire project and have moved it to CodePlex. You can check the latest version(with Email Attachment Support) here: crmdragndrop.codeplex.com

    Please do leave your feedback/comment once you have tried the new version.

    Regards,

    Chinmay.

  18. rahul says:

    hi all,

    when i tried to upload its,shown me message.

    Processing sheduler.txt

    File sheduler.txt was not uploaded. Please Contact your System Administrator.

    please,suggest me what's wrong here.I am using  MSD 2015

    Thanks

  19. Hi Rahul,

    Kindly use the newer version available at: crmdragndrop.codeplex.com

    From downloads area you can get the version that will work with Microsoft Dynamics CRM 2015.

    Regards,

    Chinmay.

  20. Alex says:

    What tweaks are required for MSCRM 2011?  I get an Invalid XML error when I attempt to import the solution.  Any chance you could post the 2011 compatible solution file?

  21. Hi Chinmay says:

    I have imported the solution successfully CrmXpressDragnDropUploadControl_1_0_0_0_target_CRM_6.0_managed(2013)

    and my CRM version is 6.0.0.809 – 2013  but i get an error message once i drag and drop an image to the box

    Processing xxxx.jpg

    File Jellyfish.jpg was not uploaded. Please Contact your System Administrator.

    this is the only file version that imported successfully

    thanks,

  22. Hi Alex,

    Sorry for the delay in responding to this comment. If you still have the requirement for CRM 2011 I can try to create one otherwise you can check the code and use it on your own. Code is not minified nor obfuscated.

    Regards,

    Chinmay.

  23. There are many reasons while a file upload fails. From file size to mime-type mismatch. It is difficult for me to comment without having more details.

  24. Apurv says:

    Hi Chinmay,

    Amazing POC!!! works fine for me, except file size exceeds 25 MBs.

    As MSCRM 2015 allows 32 MB attachment in notes. So if I drag file of size > 25MB then I get error 'Out of Memory'.

    Any Idea about this

  25. Hi Apurv,

    I am not sure if this message is coming from the Framework or the browser itself.

    I have published the latest one on: crmdragndrop.codeplex.com I suggest you try the latest version. The one published here is for Dynamics CRM 2013.

    Regards,

    Chinmay.

  26. Apurv says:

    Chinmay Thnx for replying 🙂

    Error message is given bey browser it self.

    Your framework converts file into a base64string so when file size is 25 MB+ then base64string goes too large. As result of this we XMLHTTPRequest can't be send so Out of memory issue is observed.

    I am not sure if we can use MSCRM method to upload file.

    Thanx

  27. Apurv says:

    Thank you chinmay!!

    Error message is coming from browser. As your framework converts file in to a base64string. When file size goes 25MB+ then base64string becomes too large hence ''Out of Memory'exception is thrown.

    So Can you please suggest any alternative to handle large files upload.

    Thnx.

    P.s. Wish you a happy new year!!!

  28. Thanks Apurv and Happy New Year.

    I am sorry but I do not have any workaround for this particular limitation.

  29. Kelsey says:

    Hi. Does this only work with on premise?

  30. Bhola Nath Singh says:

    hi all,

    when i tried to upload its,shown me message.

    Processing sheduler.txt

    File sheduler.txt was not uploaded. Please Contact your System Administrator.

    i also update new version for 16-

    crmdragndrop.codeplex.com/…/1533101

    please,suggest me what's wrong here.I am using  MSD 2016

    Thanks

  31. Mkissinger says:

    Hi Chinmay, could you please provide me with the solution for CRM 2011?  I have extremely minimal coding skills and probably wouldn't be able to figure out the tweaks to make.  This solution is exactly what we are looking for.

    Thanks!

  32. Akram Khan says:

    Hi Jan,

    but where i will change this:

    This does not work with CRM 2015 because you are using "getServerUrl()". Changing the code to use Xrm.Page.context.getClientUrl() would work.

    fileupload control is managed solution so can't customize  in any JS file  and html page