Copy-paste to upload attachments automatically into CRM via USD

Have you ever wondered how many clicks you have to do to take a screenshot and upload as an attachment in CRM Notes? It would definitely be a minimum of 8 to 10 clicks to complete the full process.

What if, if there is a way to do it with almost 0 clicks? Yes, In this post I will be creating a small custom control along with an action call which can help to upload attachments easily. Following are the scenarios we are going to cover up to upload attachments (annotations/notes) with this control.

NOTE: The annotation note will be created and attached to the active/focused crm page in USD. If the focused page is not a CRM page, then it will throw an error message.

  1. Take screenshot and paste (into USD) which will be converted to PNG and uploads as an attachment
  2. Copy some text and paste which will be converted into a text file and uploads
  3. Copy a file and paste
  4. Copy multiple files and paste – uploads into CRM as ZIP file.

You can further extend the control based on your requirements, I will upload the source code into GitHub.

Without wasting much time lets quickly go ahead and do the configuration required.

First of all, create a hidden hosted control with the following details.

Attribute Value Remarks
Name HiddenPasteControl Or any other name you want
Component Type USD Hosted Control
Application is Global FALSE
Display Group HiddenPannel
Application is Dynamic No
AssemblyUri HiddenPasteHandler Make sure the name is exactly the same
Assembly Type HiddenPasteHandler.USDControl Make sure the name is exactly the same

A quick reference screen:

Hidden USD Hosted Control

Now the second step – Create a Custom Action for this hosted control with name “Paste“. Make sure this is exactly the same name you are going to use. Leave the rest of all other attributes to default value.

Paste Action

Please note that the action name should be same –  Paste.

The last step of the configurations is creating the action call. Create an action call with the following information.

Attribute Value Remarks
Name Paste Content Or any other name you want
Hosted Control HiddenPasteControl If you have changed the name in Step 1 then that control
Action Paste
Shortcut Key Ctrl+Shift+v

Paste Content Action call in USD

Note the shortcut key “Ctrl+Shift+v”. This is my choice of shortcut key as it is very close to what users will generally use to paste – Ctrl+v, this will help people to have some sort of consistency in the regular tasks and at the same time I would highly recommend avoiding usage of Ctrl+v itself directly as the shortcut key, coz’ there is a high chance that you may get conflict with the regular CRM tasks. For more information on how to use the Shortcut keys along with Dos n’ Donts, Please refer my other blog post over here –

That’s it, we are almost done. Just download the following zip file and unzip the DLL file into your USD installation location (typically it is C:\Program Files\Microsoft Dynamics CRM USD\USD).

Now, Open your USD and start a session. Take some screenshot using Windows snippet tool or PrintScreen button or through any other medium, come back to USD and press Ctrl+Shift+v. Just click on the Notes section – You should be able to see the magic 🙂

Captured image screenshot
This is how the information message will be displayed for 5 seconds after Ctrl+Shift+v.

Just FYI..

  1. The attachment will get created to the active tab (it can be Contact/Case/Phone call etc.) provided the entity allows attachments.
  2. This would work only if you start a session. This is because USD will not allow accessing Session based controls from a Global session.
  3. Once after creating the attachment it will show an information message for 5 secs to the user screen.
  4. Although I haven’t set any attachment size restrictions, It is suggestible to avoid heavy attachments.
  5. You may see some freeze in USD if you are attaching heavy files, this is because the CRM service call is happening Synchronously to create the Annotation record.
  6. Feel free to modify the code for asynchronous calls or to change the name of attachment file or title.

Hope this helps for your customers in improving agent performance. You can download the source code from GitHub and use it as you wish (Note, It’s not a fully commented code but most of my method names should be self-explanatory).

I would be happy to help further if you want to understand the bits, Just reach out to me on my mail or put a comment over here 🙂 and Have a great day ahead !!


2 thoughts on “Copy-paste to upload attachments automatically into CRM via USD

  1. Pingback: Drag/Drop files into CRM to create Attachments. | CRM Ramblings

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s