1
votes

I need to sync Dynamics CRM marketing list with a mailing agent (Mailjet via API) and I thought I could use Microsoft Flow for this.

The idea is to trigger flow on marketing list update/create that will generate the JSON with list contacts info and send it via HTTP request. The problem is when I use "List Records" action I can't filter contacts based on marketing list id that I get from "When a record is created or updated (Preview)" on Marketing list entity.

I've tested that this trigger is activated when I add a new contact to a list so it should work fine. A better option will be to trigger flow( or workflow? ) within the Dynamics Marketing List view, but I'm not sure if this is possible. Can I run the JS code with the Marketing List input within Dynamics?

Can anyone point me in the right direction? I don't know C# so I'm looking for the solution on JavaScript or PHP.

Thanks!

2

2 Answers

1
votes

i think if you want do it with javascript you should add your Javascript to the OnSave Event of the Marketing List or add Javascript on the OnChange Event of the Marketing List Subgrid for Account/Contact/Lead.
Dynamics CRM Events in forms and grids

Then you can get the marketing list members via Javascript and send it somewhere. You can retrieve marketing list members via webapi, but you must be aware with static and dynamic marketing list.
Getting List members with webapi
Web Api Samples

...and i think this approach would only work for a small number of members.

0
votes

So this is indeed possible to do in Flow! Thanks to SGeis for the link to Getting List members with webapi. This link uses the entity name of listmembers to store the items inside of a list, and Marketing List is just a special type of list.

In Flow you can specify a custom Entity name. You can enter listmembers for the entity, and as the link showed you can enter _listid_value eq <Marketing List GUID here> in the Filter Query box. Example below:

Select Marketing List IDs

It will then return a list of objects that are each pointers to a contact record. In the raw json payload the contact guid is called _entityid_value,

enter image description here or just Entity when used in the Flow Interface:

enter image description here