In our last blog, we saw how we could create Power Automate Flow to send an email using the Email Template. We used “SendEmailFromTemplate” action to send a single email.
Now, in this blog, we will see how we can send bulk email messages using the Email Template.
Let us say, we want to send emails to reconnect with all our contacts in the system that we have not been in contact with for a while.
Below is how we can achieve this using the Power Automate. This could help you to create Power Automate Flow for your requirements where you may want to send bulk email messages.
Setup trigger for the Power Automate
For this example, I have used ‘Manually trigger a flow’ trigger.
Retrieve Email template
We will add ‘List Records’ step of Common Data Service Connector (Current) to retrieve the Email Template by its name (Title). We are retrieving the ‘Contact Reconnect’ template.
Add filter query to retrieve template by the title as shown below
This step will return the “Contact Reconnect” template. We will need this GUID of the template in the next step.
Retrieve records for which we want to send email
I am retrieving contacts from the system which I want to reconnect. We will add ‘List Records’ step and will retrieve contacts.
Initialize variable and store array of record’s GUID
As we want to send separate emails to each individual contact, we will first store GUID’s of each contact in an array variable.
First, initialize the array variable
Then, loop through all contacts retrieved in the above step and append GUID’s of each record to the array.
Retrieve Sender for the email
Sender of the email must be the user in the CDS environment. We will retrieve the System User record using ‘List Records’ step. We will use GUID of the user record in the next step.
Use ‘SendTemplate’ action
This ‘SendTemplate’ action is used to send bulk email messages using the Email Template. To execute this in Power Automate we need to add “Perform an unbound action” step.
This step requires below parameters,
Action Name: Select ‘SendTemplate’ from the list of actions.
TemplateId: GUID of the Email Template. In the second step, we retrieved the email template, we can use following expression to get the GUID of the template. first(body(‘GetEmailTemplate’)?[‘value’])?[‘templateid’]
Sender: Entity object of the user. Need to pass in the following format, systemusers(<guid of user>). To read the guid from the ‘List Records’ step, I can use following expression, first(body(‘GetSender’)?[‘value’])?[‘systemuserid’]
Recipients: Here we need to pass array of entity objects. I have passed the variable where I stored the list of entity objects of all the contacts. This parameter accepts value in the below format
Regarding: Record is to be set as the ‘Regarding’ of the email. In my example, setting the ‘Regarding’ does not make sense as I am not sending emails regarding any specific entity record. But, the problem is this parameter is required and it accepts entity object only. Here, I have passed the user entity object. As the user cannot be set as a ‘Regarding’, generated emails will not have regarding set.
This is all we required to send bulk email messages.
Now let us see what happens in the background. After we run the flow, a ‘Bulk Email’ system job gets created in the background. This job then creates and sends the email to all recipients separately. We can check the status in the system jobs as shown below
If you have added 5 records in the Recipients then 5 separate emails will get sent to them.
This is how we can send bulk email messages even for a large set of records.
Note: The SendTemplate action will not send emails to contact/account/lead if they opt-out for bulk email.
We can use Power Automate flow to send bulk email messages to a large set of recipients.
Free 70% of storage space in CRM with Attachment Management Apps!
Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.