Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Looking for fetch contacts based on Marketing List Id.

(0) ShareShare
ReportReport
Posted on by 4,601

HI All,

I am facing trouble in fetching contacts list based on marketing list Id. I am not getting relation key between contact and market list entities. Please guide me what key I need to use for query. If you have soap query example that would be great. 

Thanks,

Sandeep

*This post is locked for comments

  • Verified answer
    Robert Wittig Profile Picture
    1,885 on at
    RE: Looking for fetch contacts based on Marketing List Id.

    If you can write C# there is a great tool that will take an individual service request and turn it into a SOAP request.  The tool is included in the SDK it is included in the SDK here SDK\SampleCode\CS\Client\SOAPLogger.

    Here is a nice guide on how to use the tool www.powerobjects.com/.../microsoft-dynamics-crm-soap-logger-a-tool-that-can-greatly-simplify-writing-http-requests

  • Verified answer
    sandeepstw Profile Picture
    4,601 on at
    RE: Looking for fetch contacts based on Marketing List Id.

    I am using PHP code to fetch records, I can't use js for this. Please guide me if any link for making soap request for the query.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Looking for fetch contacts based on Marketing List Id.

    Rickard Nordström is partly correct. To fetch members directly only work with static list. Otherwise, you must fetch the fetchxml contained in the dynamic list (I think under an attribute called query) and call that one to retrieve the contacts. So it's possible with dynamic lists as well, but in a different way.

    To simplify the execution of the query, you can use the xrm toolkit. Read more here arunpotti.wordpress.com/.../retrieve-records-using-fetch-xml-java-script-in-crm-201113

  • sandeepstw Profile Picture
    4,601 on at
    RE: Looking for fetch contacts based on Marketing List Id.

    Is it not include any soap body?

  • Rickard Norström Profile Picture
    on at
    RE: Looking for fetch contacts based on Marketing List Id.

    Hi,

    I also think that you can only do this for static lists, correct me if I'm wrong here David.

    Regards

  • Verified answer
    David Jennaway Profile Picture
    14,065 on at
    RE: Looking for fetch contacts based on Marketing List Id.

    You need to go via the listmember entity. Try the following (replacing the Guid of the list):

    <fetch distinct="true" mapping="logical" output-format="xml-platform" version="1.0">
    <entity name="contact">
    <attribute name="fullname"/>
    <attribute name="contactid"/>
    <order descending="false" attribute="fullname"/>
    <link-entity name="listmember" intersect="true" visible="false" to="contactid" from="entityid">
    <link-entity name="list" to="listid" from="listid" alias="ag">
    <filter type="and">
    <condition attribute="listid" value="{3AB71ACC-1932-E611-80D2-000D3A20C1B1}" operator="eq"/>
    </filter>
    </link-entity>
    </link-entity>
    </entity>
    </fetch>


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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
dkrishna Profile Picture

dkrishna 6

Featured topics

Product updates

Dynamics 365 release plans