Welcome to MSDN Blogs Sign in | Join | Help

Migrating Notes and Attachments using Data Migration Manager

In Microsoft Dynamics CRM 3.0, there was no straight-forward way to import a bunch of attachment into CRM without writing some code. This has changed in 4.0. The Data Migration Manager supports migrating Notes and Attachments (collectively called annotations) to CRM. You only need to know a few tricks to get it done, as follows:-

1. Create separate CSV files for Notes and Attachments. One CSV file can have either notes or attachments, not both. The sample CSV files for Notes and Attachments are shown in Fig 1 and Fig 2 respectively.

clip_image002

Fig 1 – Sample Notes.csv

clip_image004

Fig 2 – Sample Attachments.csv file

2. Do not include the IsDocument column in the CSV file. The DMM will automatically fill this value. If you don’t want to remove this column from the CSV file, make sure that you “Ignore” this column when DMM asks you to map it to a CRM attribute.

3. If you are migrating attachments, store all the attachment files, with unique names in one of the following directories:-

a. The folder in which the CSV file that contains attachment records is present.

b. A subfolder named “Attachments” in ‘a.’

c. A subfolder named “Documents” in ‘a.’

Fig 3 shows the CSV files that we are migrating. In this example, we will use option c above. Fig 4 shows the attachment files inside a subdirectory ‘Document’.

clip_image006

Fig 3 – The CSV files being migrated

clip_image008

Fig 4 – Attachment files inside subdirectory ‘Documents’

4. Have a column in the CSV file that contains the name (not the path) of the attachment file on disk. Note that you don’t need to store the contents of the attachment in the CSV file. You should store only the name of the file. The DMM will search for the attachments in the 3 locations specified in Step 3. This column must be mapped to the ‘documentbody’ (Display Name- “Document”) column of the annotation entity in DMM. This is described in Step 6. In Fig 2 above, note the column with heading “Document”. This column is mapped to the field ‘Document’ as shown in Fig 6 below.

5. Map the CSV files which contain annotations to the Note entity in DMM as shown in Fig 5 below. If the CSV file contains attachments, check the “Includes Attachments” checkbox. If the CSV file contains notes, leave the checkbox unchecked.

clip_image010

Fig 5 – Mapping the annotation files

6. If you are migrating attachments, map the column described in Step 4 to the “Document” attribute as shown in Fig 2. If the current file doesn’t contain attachments, then you will not see the Document attribute in the columns list. Also, you will never see the IsDocument field in the columns list.

clip_image012

Fig 6- Map the Attachment name column to ‘Document’

7. Map all other columns as usual. The ‘Regarding’ column specifies the CRM record each annotation is attached to. It is no different from a lookup.

Note that the filenames of the attachments on disk can be different from what goes in the ‘FileName’ column. For example in the current example, the filenames of the attachments are ‘Costing.pdf’, ‘Members.xlsx’ and ‘Items.txt’, whereas the names of these files on disk are ‘100567’, ‘100879’ and ‘100989’ respectively.

The user will never see what filenames (identifiers) the attachments had on disk. These identifiers are used for the sole purpose of identifying an attachment file uniquely. The file name of the attachment that is visible to the CRM user is the one that is stored in the ‘FileName’ field. If an attachment in CRM has blank ‘FileName’ then its name is shown as ‘untitled.txt’ by default. So, if you want the user to see the filenames you should have a column in your CSV file which contain the user friendly filenames of attachments and this column should be mapped to the ‘FileName’ field. The values in this column i.e the one which is mapped to ‘FileName’ field can be duplicates, unlike the values in the column which is mapped to the ‘Document’ field.

To use an existing map to migrate annotations, one needs to add the following two AttributeMaps to the Data Map.

<EntityMap TargetEntityName="annotation" SourceEntityName="Attachment">

<AttributeMaps>

:

:

<AttributeMap>

<SourceAttributeName>True</SourceAttributeName>

<TargetAttributeName>isdocument</TargetAttributeName>

<ProcessCode>Internal</ProcessCode>

</AttributeMap>

:

<AttributeMap>

<SourceAttributeName>Name</SourceAttributeName>

<TargetAttributeName>documentbody</TargetAttributeName>

<ProcessCode>Process</ProcessCode>

</AttributeMap>

:

:

</AttributeMaps>

</EntityMap>

The first attribute map specifies whether the CSV file contains notes or attachments. The SourceAttributeName field can contain special values ‘True’ or ‘False’. If The SourceAttributeName value is False, then the CSV contains notes, else attachments. The TargetAttributeName is ‘isdocument’. This field never shows up in the DMM. Its value is populated automatically. Also, the ProcessCode for this mapping is set to ‘Internal’ .

The second attribute map specifies which source field contains unique identifiers of attachment files. This source field has ‘documentbody’ as the target field. This attribute-map must be added ONLY if the source file contains attachments.

Well, that’s all the magic behind migrating annotations through the Data Migration Manager. The DMM reads the attachments one by one from the disk during upload phase and creates them on the server. These notes and attachments are visible to the user in the Notes tab of the CRM record page to which these annotations are attached. Fig 7 shows the notes and attachments attached to the account ‘AccountOne’ after the migration is complete.

clip_image014

Fig 7 – Notes and Attachments of ‘AccountOne’

Cheers,

Tushar Bhatia

Published Tuesday, March 11, 2008 8:32 AM by crmblog

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Migrating Notes and Attachments using Data Migration Manager

This should really make migrating a piece of cake.  Thanks Tushar!

Wednesday, March 12, 2008 8:54 PM by Josie Fleschute

# re: Migrating Notes and Attachments using Data Migration Manager

This does make migrating notes and attachments much easier. However, it would be nice if it included how to assign values to the MS-CRM Note CreatedOn and CreatedBy values. I haven't seenhow to do this yet and migrating the notes with out these 'history' tags is less than ideal. Maybe that's in another article, I'll keep looking.

Don't get me wrong, this ability to easily migrate notes is great, just needs alittle more to hit all the usual requirements.

Thanks,

  Jeff

Friday, March 14, 2008 1:28 PM by Jeff Wessling

# re: Migrating Notes and Attachments using Data Migration Manager

Can we use a similar way for marketing list using attachment?

Sunday, March 16, 2008 7:40 AM by Joel

# re: Migrating Notes and Attachments using Data Migration Manager

Thanks for the helpful post -- I link to it in my latest blog post on how to hack the Data Migration Manager to migrate email attachments: http://dynamicscrmblog.com/9

I went about it in an inelegant (an unsupported) way, but it works. If you folks know of a better way, let me know!

Phil

Thursday, April 03, 2008 5:29 PM by Phil Edry

# re: Migrating Notes and Attachments using Data Migration Manager

Thanks Tushar, for a most instructive tutorial.

I tried tyour approach to migrate data from Act! 6, but hit this issue:

Since my annotations contain carriage returns, the Data Migration Manager will not import them properly, even if I encapsulate my CSV strigns between quotes.  Any idea how I can circumvent that without having to write code?

Thanks!

Ricardo.

Sunday, April 06, 2008 10:30 AM by Ricardo Talbot

# Error Handling in Data Migration Wizard

In this entry I am going to talk about different features in Data Migration Manager(DMM) where error

Tuesday, April 15, 2008 10:04 AM by Microsoft Dynamics CRM Team Blog

# Error Handling in Data Migration Wizard

In this entry I am going to talk about different features in Data Migration Manager(DMM) where error

Tuesday, April 15, 2008 11:19 AM by Microsoft CRM Live Team

# Error Handling in Data Migration Wizard

In this entry I am going to talk about different features in Data Migration Manager(DMM) where error

Tuesday, April 15, 2008 11:34 AM by Microsoft Dynamics CRM Team Blog

# re: Migrating Notes and Attachments using Data Migration Manager

I want to add and rety the notes from any entity

Please help me

Monday, April 28, 2008 4:29 AM by Kannan

# re: Migrating Notes and Attachments using Data Migration Manager

If a file is to be attached to more than one contact or account, how is this done?

Tuesday, May 06, 2008 5:01 PM by Al

# re: Migrating Notes and Attachments using Data Migration Manager

How would  I import a file and link it to 2 or more contacts?

Wednesday, May 07, 2008 7:53 AM by ragnarok89

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker