cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smoupre
MVP

Get Contacts that are members of a Dynamics 365 CE Marketing List

I am looking to retrieve the Contacts that are members of a Dynamics 365 CE marketing list. Can someone help point me in the right direction on this? I can connect to the CDS instance no problem and I can see Contacts and Marketing Lists, I just don't know the ODATA or other syntax magic to get the members of the particular Marketing List that I desire. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

@smoupre - The simplest method is to create a flow from within a Solution using the "Common Data Service (current environment)" option. I did a test on this and it work perfectly. See points and screen shots below. 

 

  • Go to the maker site of https://make.powerapps.com and select the correct environment.
  • Choose "Solutions" on the left.
  • Create a solution. 
  • Open the solution and select "+New" from the top and choose "Flow".
    • This will launch Power Automate.

Note: I'm not sure what your trigger is to kick off the flow. In my screen shots below, I just used the Flow Button to start it.

 

  • Search for the "Common Data Service (current environment)" using the search field.
  • Once you select it, choose "List Records".
  • Now comes the cool part: Since you are using the "CDS (current env)" option, there are multiple ways to filter the records. Below you can see I am using Fetch Xml.
    • To get the Fetch Xml code you need, just do an Advanced Find in Dynamics 365 and start with Contacts, then choose "Marketing Lists" as the related entity.
    • I chose the filter of "Name" equals "<enter your marketing list name>"

Dynamics 365 - Advanced FindDynamics 365 - Advanced Find

 

  • Click the "Download Fetch Xml" and open it in Notepad.
  • Copy the Fetch Xml and paste it in the "Fetch Xml Query" field.
  • It will look like this:

Power Automate - Filter with Fetch XmlPower Automate - Filter with Fetch Xml

 

I tested the output of this by putting the values into an HTML table:

Power Automate - Output within HTML TablePower Automate - Output within HTML Table

 

 

 

 

 

 

 

 

 

 

 

 

 

Here is the resulting output within the HTML table:

Power Automate - HTML Table outputPower Automate - HTML Table output

View solution in original post

3 REPLIES 3
v-litu-msft
Community Support
Community Support

Hi @smoupre,

 

You can refer to this document that uses filter expressions in OData URIs to limit the results that are returned in CDS. 

https://docs.microsoft.com/en-us/dynamics-nav/using-filter-expressions-in-odata-uris

 

For example, I want to get the member name is equal to "Michel", please notice that the dynamic content should have two single quotes after the operator:

Annotation 2019-12-24 092439.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-litu-msft. So what property then do I filter on for the marketing lists that a Contact is a member of?

@smoupre - The simplest method is to create a flow from within a Solution using the "Common Data Service (current environment)" option. I did a test on this and it work perfectly. See points and screen shots below. 

 

  • Go to the maker site of https://make.powerapps.com and select the correct environment.
  • Choose "Solutions" on the left.
  • Create a solution. 
  • Open the solution and select "+New" from the top and choose "Flow".
    • This will launch Power Automate.

Note: I'm not sure what your trigger is to kick off the flow. In my screen shots below, I just used the Flow Button to start it.

 

  • Search for the "Common Data Service (current environment)" using the search field.
  • Once you select it, choose "List Records".
  • Now comes the cool part: Since you are using the "CDS (current env)" option, there are multiple ways to filter the records. Below you can see I am using Fetch Xml.
    • To get the Fetch Xml code you need, just do an Advanced Find in Dynamics 365 and start with Contacts, then choose "Marketing Lists" as the related entity.
    • I chose the filter of "Name" equals "<enter your marketing list name>"

Dynamics 365 - Advanced FindDynamics 365 - Advanced Find

 

  • Click the "Download Fetch Xml" and open it in Notepad.
  • Copy the Fetch Xml and paste it in the "Fetch Xml Query" field.
  • It will look like this:

Power Automate - Filter with Fetch XmlPower Automate - Filter with Fetch Xml

 

I tested the output of this by putting the values into an HTML table:

Power Automate - Output within HTML TablePower Automate - Output within HTML Table

 

 

 

 

 

 

 

 

 

 

 

 

 

Here is the resulting output within the HTML table:

Power Automate - HTML Table outputPower Automate - HTML Table output

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,462)