Skip to content
+1-888-319-3663

HELP ARTICLE

Dynamics 365 Sales Notes and Attachments


Dynamics 365 Sales/CRM allow notes to include attachments. SmartConnect can import and export many different file types that are used with notes. Below I’ll go into detail about the steps required to use different file types with CRM notes.

CRM notes are stored in the entity “Annotation”. You will be required to give your note a subject and a regarding value. The regarding field will be an entity lookup to the record with the note.

No attachment, just text

The simplest option is to not include an attachment. In this scenario the only fields that need to be mapped are Subject, an entity lookup value to the Regarding field, and the Description field.

Attach a text file

This will work with all common file extensions.

This option is a little more challenging than just using the note text field.

1. use a source field containing text for document

You will need to provide a Subject and Regarding Object Id same as before, but you will also need to include three other fields about the attached document.

The calculated column for the documentbody will convert the standard text in the text file to base64 encoding which is the way CRM expects it. The script will look something like this:

dim PlainTextBytes = System.Text.Encoding.ASCII.GetBytes(_SOURCEFIELD)
return System.Convert.ToBase64String(PlainTextBytes)

2. Reading from a text file in a folder

If you have the file path this can be done.

Using the same mapping shown above, change the calculated column to the following.

_FILEPATH can either by a source column, or a hardcoded file path including the extension.

Ex. C:\Users\Administrator\Downloads\notes.txt

return System.Convert.ToBase64String(File.ReadAllBytes(_FILEPATH))

 

Attach an Image/PDF/MP3/MP4

This will work with all common file extensions.

I tested this in two scenarios.

1. File is saved in a folder.

When the file is coming from a folder you will need to map the following five fields.

The calculated column mapped to document body should contain the following script.

_FILEPATH can either by a source column, or a hard-coded file path including the extension.

Ex. C:\Users\Administrator\Downloads\notes.txt

return System.Convert.ToBase64String(File.ReadAllBytes(_FILEPATH))

2. File is already in another CRM instance

You will need to map the same five fields as above, only this time you can map the file name and document body directly from the source environment, because it is already encoded correctly.

Export from CRM to file

The SmartConnect mapping window won’t be able to export to a file, but you can do it using document task.

Below is the script I used in a predocument task to take the attachement from the document body and decode it and write it to a local folder.

Dim FilePath as String = “C:\Users\Administrator\Desktop\eOneImage.jpeg”
Dim imageFile as FileStream = new FileStream(FilePath, FileMode.Create)
Dim Image As Array = System.Convert.FromBase64String(_DOCUMENTBODY)
imageFile.Write(Image ,0, image.Length)
imageFile.Flush()

This approach has worked for text/images/PDF/MP3 and MP4 in my testing.

Errors

“Attachment file size is too big”

The default size is 5 MB, but can be bumped up to 128 MB.
This Article has instructions for changing the setting. As the author of the article states, it can become very expensive if you attach multiple large files in a hosted environment.

Error messages when importing annotations are attached to the note in CRM, which can make it hard to track down if the integration failed.

If you want to take these integrations a step further you can use this article as a reference for moving a file after it has been imported.

RECENT POSTS


Use the REST Connector to parse nested Value Arrays
SmartConnect email task fails with error: An invalid character was found in the email header
Does SmartConnect import into Avalara Avatax software
Could not initialize a collection when launching SmartConnect
ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key when you open a SmartConnect map.

POPULAR POSTS


SSL Security error using OLEDB Connection
This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms
Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))
The server process could not be started because the configured identity is incorrect.
Using WINSCP and a task to upload or download files from an SFTP site

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships partners Popdock release Reporting SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.