Thursday, 26 June 2014

Import Multiple Images from Physical Directory to CRM 2013 Entity Image field Using SSIS + KingswaySoft SSIS Connector

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

My Calon UL Create New - 2

*In CRM 2013

Contoh dr

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 Smile)

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
Contact1

2. Mesut Ozil
Contact2

3. Miroslav Klose
Contact3

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)

image

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)

Database source find contact

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

image

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)

image

6. Okay, I go through 1 by one for each control.

* Flat File Source
Create a new Flat File Connection Manager, browse your file.

FlatSource1

Go to the Columns

FlatSource2

Go to Advanced and rename your columns

Column0 to ImageParh
Column1 to ContactId

Then, here is the preview

FlatSource7

* Drag green connector from Flat File Source to Import Column

*Import Column

Go to Input Columns

ImportColumnNew1

Go to Input and Output Properties, add the Column Output, rename to ImageFile, and please remember the ID = 24

ImportColumnNew2

Go to the Input Column, Image Path, and fill the FileDataColumnID to 24

ImportColumnNew3

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

CRM Des1

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.

CRM Des Final

Execute the Task for testing purpose, later for batch job, you can deploy the SSIS Packages as well.

DataFlowTaskFinal Result

Ah yes, 3 rows have been executed successfully.
And here is the result

Before After
Contact1 Thomas Mueller Result

Contact2 MesutOzil Result

Contact3 Miroslav Klose 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!

3 comments:

  1. This is also a way to do it: -
    https://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2013/09/26/how-to-use-entity-images-in-crm-2013.aspx

    ReplyDelete
  2. This paragraph offers clear idea for the new users of blogging, that actually how to do blogging.


    My blog navigate to this website

    ReplyDelete
  3. hi Aileen

    I'm trying to load images into Dynamics CRM 2015 from a physical directory using Kingsway Integration toolkit. The strange thing is the image field is a GUID lookup field which references a record in some system table called ImageDecriptor. And there is no way to write to this system table using Kingsway.

    Any Idea or workaround is highly appreciated!

    ReplyDelete

My Name is..