Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Have you been wondering how you can build a dynamic list of email addresses that can be used to generate a new email? Below, we will take a look at how to build this list using Power Automate. We will also look at how to send this list using the Outlook connector and will then compare this with sending an email directly from Dynamics using the Common Data Service(Current Environment) connector.
Let's get started.
First, choose whichever trigger is necessary for generating the email recipient list. For this walk-through, I am simply using a recurrence trigger so that I can trigger it manually.
Once you have your trigger specified, you want to choose the Initialize Variable action for your recipients list, which will be built as an array
You can get your list of recipients from any data source available, but in this case, I am building a list of the top 5 Contacts that have an email address for demonstration purposes. This is using the Common Data Service (Current Environment) connector. To keep this simple, I am returning the top 5 Contacts where the Email Address field is NOT NULL.
You will need to iterate through each Contact record by choosing the Apply to Each action. Within the Apply to Each action, add the Append to array variable action to add the email address value to the array. In this case, I pull in the emailaddress1 using dynamics values from the returned Contact records.
Outside of the Apply to each loop, you need to join all of the array values with a semicolon. Select the Join variable action. Specify the outputs of the array values and enter a semicolon to join the values.
You can run the current configuration to test your results. When you look at the results of Join, you will see the following
You will see the inputs of the array and the outputs into a string of email addresses.
To send this using the Outlook connector, select Send an email (v2) action. Specify the Output of the Join function in the recipients line
After you send, you will see the recipients listed and sent successfully.
Now, if you want to achieve the same thing, but send directly from Dynamics, you will run into some complications. Dynamically building a list of recipients and adding to an email like we did in the Outlook connector, is not yet possible. Let's take a look.
Below, I have selected Create a new record using the Common Data Service (Current Environment) connector. For the entity name, select Email Messages.
As you can see below, you must individually specify each recipient value. Meaning, you would need to know the entity type and number of recipients. It requires the format as /entitylogicalname(recordid) in the Activity Party Attribute field. Unfortunately, you cannot specify multiple values in a string like we do with Outlook. There is a product enhancement suggestion to vote on here. Ability to dynamically build recipient list for Create Email Message in CDS (current environment) action
You can also use the following syntax /entityname/
Stay tuned for the next post on creating and sending an Email from Dynamics using Power Automate.
Business Applications communities