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 :)
Web Designing Company in Bangalore | Website Development Company in Bangalore | Website Design Company in Bangalore | Custom CRM software Development Services in Bangalore
ReplyDeleteNice post it is really an interesting article.We are also providing the website design services in mumbai. We are
ReplyDeletebest web design company in mumbai
best ecommerce website development company in mumbai
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