web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to get Marketing List Members in plug-in

(0) ShareShare
ReportReport
Posted on by

I want to get marketing list Account and contact member, But i can not find the member's entity.

2018_2D00_06_2D00_12_5F00_093957.png

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You should look for listmember entity. It's intersect N-N entity.

    Check this article - community.dynamics.com/.../learning-how-to-query-for-marketing-list-members

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Evan li,

    What are you trying to achieve with your plug-in?

    The "Targeted At" field has a schema name of createdfromcode, and a Description of "Select the type of members that this marketing list will contain: accounts, contacts, or leads. Each list can have only one member type and this value can't be changed after the marketing list is created.” The Members section is usually for displaying accounts, contacts, and leads.

  • Community Member Profile Picture
    on at

    Hi Andrew,

    Thank you for your help.

    In below code

    [Code]

    RetrieveMultipleRequest request = new RetrieveMultipleRequest { ReturnDynamicEntities = true, Query = query };

    RetrieveMultipleResponse response = (RetrieveMultipleResponse)crmService.Execute(request);

    retVar = (response.BusinessEntityCollection.BusinessEntities.Count > 0);

    [/Code]

    I can not find the attribute : RetrieveMultipleRequest.ReturnDynamicEntities  and RetrieveMultipleResponse.BusinessEntityCollection

    2018_2D00_06_2D00_12_5F00_105732.png

    2018_2D00_06_2D00_12_5F00_105732.png

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Evan, I'm sorry for this. It seems that this code is related to v 4.0. Let me bring you another example - nishantrana.me/.../sample-code-to-retrieve-all-the-members-of-a-static-marketing-list-in-crm-2011

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Evan li,

    Did you use QueryExpression with the LinkEntity property to properly assemble the query?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    You can use the following query expression to retrieve list members:

              QueryExpression query = new QueryExpression()

               {

                   EntityName = "contact",

                   ColumnSet = columns,

                   LinkEntities =

                   {

                      new LinkEntity()

                      {

                          LinkToEntityName = "listmember",

                          LinkToAttributeName = "entityid",

                          LinkFromAttributeName = "contactid",

                          LinkEntities =

                          {

                              new LinkEntity()

                              {

                                  LinkToEntityName = "list",

                                  LinkToAttributeName = "listid",

                                  LinkFromAttributeName = "listid",

                                  LinkCriteria =

                                  {

                                       Conditions =

                                       {

                                           new ConditionExpression("listid", ConditionOperator.Equal, listid)

                                       }

                                  }

                              }

                          }

                      }

                   }

               };

    If you are using a Dynamic List, you can use the following:

    Entity list = service.Retrieve("list", listId, new ColumnSet(true));

    listType = (bool)list.Attributes["type"];

    query = list.Contains("query") ? list.Attributes["query"].ToString() : string.Empty;

    FetchExpression fe = new FetchExpression(query);

    EntityCollection rc = service.RetrieveMultiple(fe);

    Hope this helps...

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Aric,

    The second Link makes no sense in this particular case. It's possible to filter based on intersect entity.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Andrew,

    Copied some old code that I had. Didn't check into too much detail, but it is working in some solution.

    Thanks for the catch, I will fix it in the solution.

    All the best.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans