Set Dynamic Recipients of D365 Email in Power Automate
Introduction : We can send email using D365 Connectors in Power Automate. To know about how to send emails, refer my blog: https://www.cloudfronts.com/send-d365-email-using-power-automate/
In this scenario where, the activity parties (TO, From, CC) ae static, we can easily send emails. However here is how we can set the activity party dynamically on the Email.
![](https://www.cloudfronts.com/wp-content/uploads/2021/01/image-6.png)
Solution:
The create a record of Email message is as below, here we are entering the attributes of activity party, by clicking on “Switch to Input entire array”
![Create a new record
•Entity name
Email Messages
Activity Party Attribute
To
Activity Party Attribute
Primary Email x
Activity Party Attribute
From
Activity Party Attribute
Email 2 X
Activity Party Attribute
Activity Party Attribute
Preferred Email x
+ Add new item
Show advanced options v](https://www.cloudfronts.com/wp-content/uploads/2021/01/image-10.png)
You will get the Array format, the participationtypemask is TO, FROM,CC while the [email protected] is the email address.
![Create a new record
• Entity name
Acttviw parties
advanced options v
Email Messages
-participationtypemask-: 2.
"partyid@odata.bind-:
Primary Email x
"participationtypemask-: 1.
"partyid@odatabind":
Email 2 x
"participationtypemase: 3,
Preferred Email x
-partyid@odata.bind-:](https://www.cloudfronts.com/wp-content/uploads/2021/01/image-8.png)
Now all you need to do is create a dynamic array, You can use append to array variable action to create an array with participationtypemask as per your requirement,
![Apply to each 3
•Select an out utfrom revious st
{x}
Append to array variable 3
• Name
Value
To
-participationtypemask•: 2,
-partyid@odata.bind•: "systemusersa _partyid_value x](https://www.cloudfronts.com/wp-content/uploads/2021/01/image-9.png)
pass this array as input to the Activity Parties field in create an email record.
![Create a new record
Entity name
Activity Parties
Email Messages
To x
Show advanced options v](https://www.cloudfronts.com/wp-content/uploads/2021/01/image-7.png)