Set CRM Email Recipients in Power-Automate using OData Binding



The provision for creating and sending Dynamics 365 CE (CRM) Emails from a Power-Automate (MS Flow) has always been appreciated due to its simplicity. But setting the Email Sender (From) and Recipients (To/CC/BCC) dynamically is always tricky. In this blog, we will learn how a CE Developer can set these Parties for an Email dynamically in a Power-Automate using OData Binding.

Please note that we have 11 different types of Activity Parties in Dynamics 365 for Customer Engagement and Microsoft crm development. An Activity Party Type is stored as an integer value in the attribute - ActivityParty.ParticipationTypeMask. For an Email Activity, we have the following Activity Party Types:

Activity Party Type Activity attribute Integer Value Description
Sender Email.From 1 Specifies the sender.
ToRecipient Email.To 2 Specifies the recipient in the To field.
CCRecipient Email.Cc 3 Specifies the recipient in the Cc field.
BccRecipient Email.Bcc 4 Specifies the recipient in the Bcc field.
Are you planning to create and send Dynamics 365 CE emails using power-automate?

Then the ultimate solution is to pass on your query to us. We are at your service and will provide the best services.

For this blog, we will consider a simple requirement to develop a Power Automate – Once an account name is updated, an email must be triggered by the user who has modified the account to the Primary Contact, keeping the Account Owner (user) in CC.


  • We begin with creating a new Power-Automate (Flow) - Send Email on Account name update. It triggers on Update of an Account Name.

  • We next initialize an Array Variable – Email_Recipients. We bind the “From” to the user who has updated the account name, “To” to the account primary contact and we “CC” the account owner. Please note that the property “participationtypemask” is 1 for “From”, 2 for “To” and 3 for “CC”.


    You can copy the value from below.



    "participationtypemask": 1,

    "[email protected]": "systemusers(@{triggerOutputs()?['body/_modifiedby_value']})"



    "participationtypemask": 2,

    "[email protected]": "contacts(@{triggerOutputs()?['body/_primarycontactid_value']})"



    "participationtypemask": 3,

    "[email protected]": "systemusers(@{triggerOutputs()?['body/_ownerid_value']})"



  • Then, we add another variable – Email_Body and initialize it with the string - “Hello, Account name is updated to <new account name>”.

  • Next, we create a new CDS record – Email Messages. Make sure to switch to input entire array for Activity Party Attributes.

  • We assign our array variable – Email_Recipients to Activity Parties.

  • We assign the string variable Email_Body to the Description attribute. We set the Email Subject – “Account Name Update.”

  • Finally, we add a new CDS action – Perform Bound Action to send the Email message. Save these changes.



  • We update an account name and check if our Power-Automate Send Email on Account name update has been executed successfully.

  • We verify that the CE Email record is created and sent successfully as expected.


Power Automate: Send an email using the Email Template

The question "What options do we have for emailing using the template on specific events/actions in Dynamics CRM?" was posed by a technical enthusiast to the forum during an online session with Power Platform professionals. "We have a classic workflow with 'Send Email' and 'Use Template' action or a Plugin with 'InstantiateTemplate' and 'SendEmail' requests for this," said one of the panelists in response to the question. There is now the possibility of doing the same thing by using Power Automate.

An example of a situation is as follows: An inquiry form may be found on the website of a corporation known as Larence and Corporation. Within the customer relationship management system (CRM), a new lead is generated for each submission, and an email with a message of gratitude is delivered to the client for each newly produced lead.

Step 1: Setup the trigger for Power Automate

At the moment when the Leads record is being created, we are going to establish a Power Automate Flow that will get a trigger. For this purpose, we will choose the trigger that states "When a record is created, updated, or deleted," and we will choose "Create" as the condition that will activate the trigger.

Step 2: Retrieve the template for the email

We will add the 'List Records' step so that we can access the Email Template by its name, which is referred to as the Title. Imagine for a moment that we are fetching the template that is below:


To obtain templates based on their titles, you need to add a filter query, as shown below:


Step 3: Use the 'SendEmailFromTemplate' action

It is possible to send Dynamics 365 emails from Power Automate an email by using the Email Template by doing this step. The 'Perform an unbound action' step is something that has to be included for this to be executed in Power Automate. To proceed with this step or activity, we are required to pass as follows:

"SendEmailFromTemplate" is the name of the action that you should choose from the list of actions.

GUID of the Email Template is denoted by the TemplateId. During the second phase, we were able to extract the email template. To obtain the GUID of the template, we may use the formula that is shown below:

The first body of the 'List_records'?What is the value of it?[...] ['templateid']

This is the Record that should be set regarding the email as it is now being sent. At this point, we will pass the newly generated Lead as the regarding consideration.

{ “email_activity_parties”: [ { “partyid_<entitylogicalname>@odata.bind”: “/<entitysetname>(<guid of the record>)”, “participationtypemask”: 1 }, { “partyid_<entitylogicalname>@odata.bind”: “/<entitysetname>(<guid of the record>)”, “participationtypemask”: 2 } ], “@@odata.type”: “” }

Activity Party Types

In the on-premises version of Dynamics 365 Customer Engagement, there are eleven different kinds of activity parties. It is an integer number that is contained in the ActivityParty that represents the kind of activity party. The property is known as ParticipationTypeMask. The following table provides a listing of the many sorts of activity parties, along with the integer value that corresponds to each type of activity party. Both the description and the ParticipationTypeMask property are included.

Activity Party Types available for each activity

A custom activity is the only activity type that is accessible for use in Dynamics 365 Customer Engagement (on-premises), however, not all activity party kinds are available for each activity. With a bespoke activity, you may accommodate any kind of activity party. Through the use of the appropriate property of an activity, it is possible to link a certain activity party type to a particular activity. As an example, to link an Organizer activity party type with an appointment activity, you are required to supply a value or an array of values of the ActivityParty type inside the Appointment.Descriptor of the organizer.

By setting the ActivityParty.AddressUsed property, you may exercise control over which email address should be used for sending emails to the activity party or for responding to emails sent by the activity party.

activityparty EntityType

Within customer relationship management systems, the activityparty EntityType is an essential component that plays a critical role in supporting the administration of various sorts of participants in a variety of activities or events.

Lookup Properties

Lookup properties are calculated properties that are read-only and include the entity’s primary key Edm when they are accessed. Data that provides direction for one or more single-valued navigation attributes that relate to it. Lookup properties and lookup property data are two more sources of information.

Single-Valued Navigation Properties

The lookup fields that are represented by single-valued navigation properties are those that can only reference a single particular entity. There is a companion collection-valued navigation property that corresponds to each single-valued navigation property that is associated with the linked entity.

Collection-Valued Navigation Properties

Collection-valued navigation properties are used to describe collections of entities. These collections may indicate either a one-to-many (1:N) or a many-to-many (N:N) connection between the entities.

Writable Attributes

Within the realm of programming, the term "writeable attributes" refers to the characteristics of an object that are capable of being altered or changed while the program is being executed. In object-oriented programming, objects are constructed from classes and the characteristics or properties that describe their state are referred to as attributes or characteristics.


DescriptionRole of the person in the activity, such as sender, to, cc, bcc, required, non-compulsory, organizer, regarding, or owner.
DisplayNameParticipation Type

ParticipationTypeMask Choices/Options

2To Recipient
3CC Recipient
4BCC Recipient
5Required attendee
6Optional attendee

What is an Activity Party in Dynamics 365 / Power Apps?

If you can believe it, the apps that makeup Microsoft's Dynamics 365 Customer Engagement are built on top of Power Platform. The Citizen Application Platform technology from the PowerApps side melded with the previous Microsoft Business Solutions product that was initially meant to be an expandable CRM system, and the final result is that this is the current state of affairs. No, they did not begin functioning in this manner.


Method for reading/getting parties using JavaScript

Although you have optimized your code, if your website continues to load too slowly, it is most likely due to scripts that are provided by third parties.

There are a range of helpful features that may be provided by third-party scripts, which contribute to the web being more dynamic, interactive, and linked. Certain of them could even be essential to the operation of your website or the flow of cash it generates. However, using them presents one risk:

The performance of your website may be hampered as a result.

They have the potential to create privacy or security concerns. They have the potential to be unexpected, and the repercussions of their actions may not have been expected.

You will want to make sure that the crucial rendering route of your website is not affected by scripts that are provided by other parties. This tutorial will lead you through the process of identifying and fixing problems that are associated with loading third-party JavaScript, as well as minimizing the dangers that your users face.

How do you determine if a page contains a script from a third party?

The first step in optimizing third-party scripts on your website is to identify them and determine the influence they have on the performance of your website. It is highly recommended that you make use of free online performance test tools such as Chrome DevTools, PageSpeed Insights, and WebPageTest to detect expensive scripts. These tools provide a wealth of diagnostic information that indicates the number of third-party scripts that are used by your website as well as the scripts that need the most time to run.


Hence, we comprehensively learned in this blog how a CE Developer can set the Activity Parties for an Email (From/To/CC/BCC) dynamically in a Power-Automate using OData Binding.

That’s all from this blog, see you in my next one.

Related article

Creativity opens up many opportunities in marketing industry; you just need to know how to make it happen.

Reasons to upgrade to MS Dynamics CRM 2016 are explained by professionals in this blog. Read them thoroughly and evaluate the advantages offered by this upgrade.

Client relationship the board is a significant aspect of a business, and most organizations decide on a few of the other kind of CRM apparatus for this reason.

DMCA Logo do not copy