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

4 comments:

  1. Nice post it is really an interesting article.We are also providing the website design services in mumbai. We are
    best web design company in mumbai
    best ecommerce website development company in mumbai

    ReplyDelete
  2. Thanks for your great post.We are the leading seo company in mumbai. Hire our seo agency in mumbai today for seo services in mumbai

    ReplyDelete
  3. This article provides a helpful walkthrough on how to create a dynamic marketing list in Microsoft Dynamics CRM, showing how to use FetchXML and C# to automatically populate the list based on specific criteria. Dynamic marketing lists save time and improve targeting by keeping your audience updated automatically. For businesses looking to streamline CRM processes and get expert help with implementing advanced features, CRM software development services like MindzCRM by Elite Mindz offer powerful customization and support.

    ReplyDelete