Synchronise Outlook mailing lists with Dynamics Marketing

Dynamics Marketing isn’t just for external Marketing to customers - its also a really awesome tool for companies to use as a communication and announcements to their internal staff and teams. You can produce really smart emails with engaging content that get important messages to employees, schedule them to send at the best times and also set up automation such as reminders to complete training courses. So many possibilities!

Traditionally such communications are done by distribution groups or mailing lists in Outlook, so how can we leverage those lists in Dynamics Marketing - with Power Automate of course! We are going to create a flow which will trigger updates to a static Marketing List when members are added or removed from an Office 365 group to ensure the list is kept in sync at all times. Then finally we use that list in a Dynamic Segment to power our customer journeys.

Note: DistoListo is Australia for Distribution List of course….

Result.png
O365Group.png

Were going to use the ‘Office 365 Groups’ connector with the trigger - “When a group member is added or removed“. Two things on this one

  • Must be an Office 365 group, not a distribution list (most existing distributions lists can be upgraded to Office 365 groups)

  • You must be an owner of the Office 365 Group

1.png

1) Select the O365 Group to synchronise

2) Initialise a blank array (we will use this later)

3) Use the CDS ‘List records’ action and search for the marketing list to populate

2.png
4.png

4) Capture the GUID of the marketing list (we will use this later)

first(outputs('Search_for_Marketing_list')?['body/value'])?['listid']
3.png

5) Capture the OData URL of the marketing list (we will use this later)

first(outputs('Search_for_Marketing_list')?['body/value'])?['@odata.id']
5.png

6) Get the users details from their user profile in Office 365 - making sure yo select on the fields you need. Check the available properties for this record here

6.png

7) Use the CDS ‘List records’ action and search for the contact in Dynamics first

7.png

8) Capture the Contact GUID (we will use this later). If they are not found this will just be blank but that’s ok for now.

first(outputs('Locate_Contact_for_user')?['body/value'])?['contactid']

9) Use the “List group members” action to get the current list of members from the group - this returns the list as an Array

8.png

10) Compare the User ID from the trigger (the one added or removed) to the list you just pulled from the current list using the ‘Select’ operation

9.png

11) Check condition is used to compare the ‘Body’ i.e. the output from the step about (10) and to see if its blank or not. If its blank - the member was removed from the list. If its not blank - the member was added to the list.

10.png

Member removed from O365 group

12) Use the amazing “unrelate records” CDS action to remove the contact from the list - using the contact GUID (8) and the OData URL of the marketing list (5)

Member added to O365 group

13) This condition checks the output from (7) where we 7) searched for the contact in Dynamics - if its blank we need to create the contact - if not then we can skip this step

14) Create a contact, using the data captured from (6) with the user details from their office 365 profile

15) The equally amazing “relate records” CDS action now, to add the contact to the list - using the contact GUID from (8) and also from (14) for the Item ID, only one of these will ever be populated, then using the same OData URL of the marketing list (5) for the URL

11.png
empty(body('Locate_Contact_for_User')?['value'])

16) Final step is to create a Dynamics Segment which references members of ‘DistoListo’ Marketing List ready to use in our Customer Journey automation

sEGMENT.png

Ideally for the Dynamics Marketing world we wouldn’t use the marketing list and instead directly populate a Static Segment - but you will have to wait for my post next week to find out about that beauty. Until then - happy synchronising!

Previous
Previous

Add Contacts to Segments - with Power Automate!

Next
Next

Flip the switch: two option (yes/no) fields in model-driven Power Apps