As we know that in CRM 2013, there is a new field type: Image type, called as entityimage.
In CRM 2011, I had a project to show image in the Contact Form, and yes, I usually use IFrame to show the Image and the image is stored physically in the File Server.
*In CRM 2011
*In CRM 2013
Now, the company wants to show the Image in entityimage field in CRM 2011, how to achieve this?
1. Manual Import (assuming you have million data and it is increasing since the company still maintain two system, then need more people to do it
)
2. Using custom code + SDK to read file from physical folder then update the contact entity image programmatically.
3. Using SSIS + KingswaySoft Data Connector.
(Luckily,I was checking to KingswaySoft Website, and it is clearly, it supports the entityimage field)
This time, I will not talking about point no 1 and 2, I want to talk about point 3, which is according to me, it is the best and the fastest way!
So, here is my scenario as example.
To make this example real and more interesting, and this is the moment of World Class Football Party, I have 3 Contacts of Germany greatest footballer in CRM 2013 as Customer.
1. Thomas Mueller
2. Mesut Ozil
3. Miroslav Klose
I want to add Manuel Neuer as well, but okay, I decide to only use 3 samples.
Those 3 contacts are currently having no photo, let’s give picture to them!
Then, here we go.
1. First of all, preparing your image folder (back to client requirement, in CRM 2011, we stored the image physically under file server folders)
2. Step number 2, create a flat file, it can be .csv or .txt
With format:
[ImagePath],[contactid]
This contactid is the CRM Contact Id as destination
(In this case, I stored contact guid, you can use Text as well)
So, here is your file looks like:
C:\Installer\Aileen\Image\MesutOzil.png,07D31879-41FD-E311-943B-001CC4EECDD6
C:\Installer\Aileen\Image\ThomasMueller.png,E36D306A-41FD-E311-943B-001CC4EECDD6
C:\Installer\Aileen\Image\MiroslavKlose.png,A26EB788-41FD-E311-943B-001CC4EECDD6
Save your file as imagelist.txt
3. Then, create the SSIS Project
You can refer to this link:
http://msdn.microsoft.com/en-us/library/ms170419.aspx
There are millions tutorial published in the internet.
4. Then, you create a Data Flow Task
5. You need 3 components:
- Flat File Source
- Import Column
- Dynamics CRM Destination (this is SSIS Data Flow Component that you can get after installing Kingswaysoft)
6. Okay, I go through 1 by one for each control.
* Flat File Source
Create a new Flat File Connection Manager, browse your file.
Go to the Columns
Go to Advanced and rename your columns
Column0 to ImageParh
Column1 to ContactId
Then, here is the preview
* Drag green connector from Flat File Source to Import Column
*Import Column
Go to Input Columns
Go to Input and Output Properties, add the Column Output, rename to ImageFile, and please
remember the ID = 24
Go to the Input Column, Image Path, and fill the
FileDataColumnID to 24
Next, again, drag the green connector to CRM Destination
*CRM Destination
Create new Connection Manager, then Configure the Microsoft Dynamics CRM Destination
Action: Update
Destination Entity: contact
Go to Column, and then map the input and output columns.
Map ImageFile to entityimage
and ContactId to contactid
*NB: KingswaySoft can support Text Lookup, so if in case you don’t use guid as reference, you can use email or fullname (if unique) as well, but in this case, I’ve had used contactid, and lazy to revert back, and actually I store contact id in the image properties of my client folder.
Then, here is the magic, using this Connector to Map your Image file to CRM entityimage.
Execute the Task for testing purpose, later for batch job, you can deploy the SSIS Packages as well.
Ah yes, 3 rows have been executed successfully.
And here is the result
As you can see, now the images have been copied to entityimage of Contact, it did not irk the developer to do it and did not waste the time.
Easy, Faster, and Comfortable.
This combination (SSIS + KingswaySoft) helps me immensely.
And hopefully my blog post is helpful for everyone!