Wednesday, June 12, 2013

Create Dynamic Marketing List in CRM 2011 with C# .Net


If you want to create Dynamic Marketing List in CRM using C# please follow these steps

1. Create your Desired FetchXML using Advance Find in CRM.
2. Download that FetchXML.
3. Use that FetchXML in below code (Just replace " with ' )

your final code looks like

var service = new XrmServiceContext("Xrm");
            String fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
  <entity name='contact'>
    <attribute name='fullname' />
    <attribute name='telephone1' />
    <attribute name='contactid' />
    <order attribute='fullname' descending='false' />
    <filter type='and'>
      <condition attribute='address1_city' operator='eq' value='Florida' />
      <condition attribute='address1_country' operator='like' value='%USA%' />
    </filter>
  </entity>
</fetch>";


            // Create dynamic list. Set the type to true to declare a dynamic list. Set CreatedFromCode to 1 for account member type.
            List dynamicList = new List()
            {
                Type = true, //True for Dynamic List
                ListName = "Dynamic List", //Name of the List
                CreatedFromCode = 2, //1 For Account; 2 For Contact; 3 For Lead
                Query = fetchXml
            };
            Guid _dynamicListId = service.Create(dynamicList);
         
Advantages: Some companies uses marketing list very frequently for example they want different marketing list just with a address1_city change for this purpose we can use .Net to develop such type of Marketing lists easily.

I hope it helps someone :)

Wednesday, June 5, 2013

5 Ways to Import Large Data in Microsoft Dynamics CRM 2011

In this article, I have mentioned possible ways to import data in CRM 2011
There are five possible ways to import data in CRM. If I have missed any, please mention in Comments
  1. CRM 2011 import wizard
  2. Write your own web service using ExecuteMultipleRequest
  3. SSIS Packedge
  4. Use third party integration software like Scribe 
  5. Direct SQL Queries (Unsupported)
Which one is more efficient between these methods depends on your CRM structure, the source of your data, the complexity of the transformation, etc. Every possible solution has some advantages and some disadvantages. 


1.       CRM 2011 import wizard

We can use import wizard to import data in CRM 2011. It is very easy to use. Please follow steps to import data using import wizard.
Download template for the entity that you want to import in CRM

Open the downloaded file

 Fill the excel file with your data

Save the file and from ribbon select import data

This will open import wizard, Browse to your file and select your file as mentioned in below screenshot

Select your desire file and click on submit.

After few times the data will be, upload successfully.

Limitations:

We can’t import non-printable characters using above method.
If we want to Import any entity that has 1:N relationship we need to copy them in one zip file.
If you want to import Unicode data please use XML not Excel.
File size limit is upto 8 MB you can make chunk of data to import them in CRM.

2.       Write your own web service using ExecuteMultipleRequest

Please check my previous blog for this purpose

3.       SSIS Package

We can create SSIS Package to insert data in CRM 2011. Andrii Butenko One of MVP has already write an article on how to integrate CRM 2011 using SSIS. This is really good article so I mentioned it here

4.       Use third party integration software like Scribe.

Many third party tools available that can be used to import data in CRM. Scribe is one of them.

5.       Direct SQL Queries

We can also write SQL queries to insert data in CRM but it is unsupported and not recommended by Microsoft.

Limitations:

Writing direct SQL queries is not supported by Microsoft. One of the biggest disadvantage of using SQL queries is that you bypass Business logic.


I hope it helps someone :)
If you have any suggestion please comment.