This is a kind of CRMised solution for my post Copy-paste to upload attachments automatically into CRM via USD.One should have USD in play to use that approach.
In this post, I would like to explain a solution which I have created to easily upload the files into CRM. Here is a quick glimpse of how its gonna work? Click on the video below.
Want to have a quick play with it and see how it is? Here is the access to my trail CRM version (Valid till Feb’17).
User ID:firstname.lastname@example.org; Password: Blog@User
Now that you got the understanding on what we are trying to do here, Let’s see the steps involved.
Step 1: Download the Solution and import the solution
Step 2: Add HTML Web resource to the <> form.
If you are familiar with CRM Customizations, Jump on to Step e directly from here. There are some key points to take in that step.
a) Create a new solution (although you can do the customization changes in default organization, but it is highly recommended to go for a new Solution) by navigating into Settings>>Solutions>>New Solution
b)Create the solution with required details for Name, Publisher etc. Here is the sample screen fyr.
c)Add the required entity forms to the solution. For the sake of demonstration purpose, I’m adding Case entity for this solution. Note that, You don’t need to add any dependencies, Only the form on which you want to add the web resource is good enough.
d)Open the form designer for the form and click on the Insert Web resource Tab in the ribbon.
|General||Web resource*||fdd_/HTML/FileUploads.html||This will only come if you import the solution mentioned in Step#1 successfully|
|General||Name||FileUploadControl||Any name you want|
|General||Label||File Upload into CRM||Any Label you want|
|General||Display label on Form||No||I don’t want to clutter the form with some label of no use, But it’s up to you.|
|General||Visible by Default||Yes|
|General||Pass record object-type code and unique identifier as parameters.||Yes||This must be a Yes|
|Formatting||Layout||Two Column||Selected this because it would work for my Form. You can set it based on your form style/location|
|Formatting||Number of Rows||5||anything b/w 4 to 6 gives a decent look to the control|
|Formatting||Display Border||No||I found it more cool w/o border. Up to you again|
Here is a quick preview screen :
Note that Selecting the “Pass record object-type code and unique identifier as parameters” is a key selection. This gives the web resource the required record Id & Type to create notes.
f) Save & Publish the changes; This is how the output looks like.
That’s it, You are all set. Just drag and drop a sample file to test it 🙂
Before wrapping up the post, Here are some of the important points that are not discussed so far in the post.
- Apart from Drag & Drop files into CRM, One can also use Browse button to select the files required. This is provided as a fallback scenario where users are working with some bad mouse or incompatible browser etc.
- Optionally, Users can select Prompt for the title, Prompt for the description before clicking on the Upload link. This will then prompt for the title & description to create notes (annotation record).
- For the sake of the blogging, I have selected Case. But you can use the web resource for any entity which is enabled for notes.
- I haven’t placed any file size restriction, but CRM has the 5MB limit. So you upload a big file, CRM will throw an error for you. My suggestion is not to drop too big file, which might hang the browser for some time as it will try to read the file first.
- The drag/drop functionality is based on HTML 5, So I would expect the users to be on new era browsers. (I don’t think this would be a big problem as CRM/Dyn365 on its own will not support old browsers).
- When the document is loaded, It will check for the record id. If it is not available, It will throw an error and stops attaching the required events. This would occur in 2 scenarios. a) You forgot to select the “Pass record object-type code and unique identifier as parameters” in web resource b)If it is a new record. In case of a new record, Users have to first save the record and then refresh it to start using.
- I haven’t used any fancy uploading images, as I want to keep it as simple as possible. Attached the source code also at the end of the post, Play with it and design as you like 🙂
Here are all the links once again!!
Hope this helps in your projects, Feel free to contact me in case of any troubles !!