Question

I'm trying to get the list of members of a dynamic marketing list. When it's only a single (or just a few) lists, I could fetch the results of the underlying query individually. However, when the number of marketing lists raises, the fetching one-by-one becomes quite ineffective.

For static marketing lists it should be straight-forward, I expect. I should be able to fetch all instances of the entity Contact (or whatever the base type used for its creation is) when filtering for a set of guids corresponding to all the marketing lists based on Contact in my QueryExpression object. Is that correctly perceived?

(How) can I fetch all the underlying members of all the dynamic list on the server?

enter image description here

EDIT: This is the automagically generated fetch-XML.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="account">
    <attribute name="name" />
    <attribute name="primarycontactid" />
    <attribute name="telephone1" />
    <attribute name="accountid" />
    <order attribute="name" descending="false" />
  </entity>
</fetch>
Was it helpful?

Solution

Well, combining of FetchXML queries would be too difficult (if even possible) for your requirements (non-distinct records in results and keeping name of marketing list to which members belong to). Please note that according to documentation FetchXML query can be run against only one root entity (say Account or Contact), other entities can be only linked. Since you do not have direct links between Accounts and Marketing lists in the database (instead of that you have just a FetchXML string stored in DB), you will not be able to use link-entity for your job.

Assuming you are doing it now via C# code - this is actually a good way to go. It will give you more control on your data - you can rearrange/combine/convert easily. I think that you should not worry about performance. Several fetch xml executed one by one would not take much more time than a huge combined one may potentially take. Also if you implement collection manipulation wisely in C# you can achieve pretty good performance. I really do not think that combined huge FetchXML will give any performance benefits, but only difficulties to maintain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top