Prior to Power Automate (formerly Microsoft Flow), many of you probably sent emails using a workflow in Dynamics 365. This option has been around for quite some time. Typically, you have some automated process where emails go out to notify internal personnel or external customers. But, you may have seen the "nag" message within the classic workflow screen (see the below screen shot).
Here is a simple example of the classic setup.
The next step would be to customize the email message.
Lastly, you would activate the workflow and all would be good to go. And, the great thing about this option is that the sent email will be saved as an Email Activity within Dynamics 365, and show up in the Timeline associated with the record.
Then there's Power Automate
Power Automate now provides the same concept of sending Dynamics 365 emails. However, there are few things to be aware, and the setup is different.
First, you will need to create the flow from within a solution. If you are not familiar with this process, it's pretty easy.
Click "New" at the top, give the solution a name and Publisher, and then save it. This will show the solution in the solution list.
Click on the new solution name to open it.
Second, you need to click the "New" and then "Flow" option at the top. This will launch a new tab/window within your browser to start building the flow.
The flow setup
Now that the flow screen is up, you will need to understand a few things. First, you will need to be sure you are using the "Common Data Service (current environment)" trigger. This trigger only has one action of "When a record is created, updated, or deleted". But, it's important to keep using this same connector throughout the flow for all the CDS actions.
Next, there some neat tricks to help you building the flow, and, subsequently, the email message.
Variables are your friends
If you haven't used variables before (or compose), they are simple to set up in Power Automate and can be used multiple times. This comes in handy when you have long flows.
You will need to initialize a variable prior to setting the variable value. To find the variable actions, simply search for "variable".
In the list above, the "initialize variable" is listed. Choose this option to start creating the variable.
The above screen shot shows a variable I set up which will allow a custom email message to be created. By using a variable, I can plug in dynamic content pulled from various steps in the flow.
For our example, I will keep this simple. The below screen shot shows a simple example of an HTML message.
"To", "CC", and "From" flow items
If you consider the goal of the flow of sending a Dynamics 365 email, you will realize there are other items you need. The other items you may need are the "To", "CC", and "From". Again, use the "CDS (current environment) connector" for these actions.
The "To" and "CC" recipients will need to reference some record(s) within Dynamics 365. Typically, this is a Contact record. The "From" is which account will be sending out the email. You may have a special account set up already that is sending out the classic workflow emails.
Here are simple "Get Record" actions for both the "To" contact and the "From" user.
Creating the email message
The next step is to create the email message you want to send out. If you have followed along so far, you should have some of the basic items needed to create the email message. This step will also create the Email Activity within Dynamics 365 and associate it with the correct record. Thus, recreating the classic process in Power Automate.
You will need to use the "Create Record" action and choose the "Email Messages" entity. Once you do this, the full action will load with many fields. For this reason, I will show just a few of the basic fields to get the record created.
Email Activity Parties
First, you will need to set up the Activity Party Attributes. If you have these ready, based on the above section, you can plug these into the fields as shown below. Something important to note is that if you have multiple "To" or "CC" recipients, you will need to add these as individual Activity Parties. As you can see below, there are 2 "CC" fields listed.
Second, in the example below, I have the "To" matched with a Contact associated with a Case. The "CC" is another contact that wants to be copied on the message. The "From" is the User account used for sending out the email message. The last "CC" is the Owner of the Case. This will keep the owner aware that a message went to the customer.
Email Description
The next field to update is the "Description". This will be the body of the email. If you used the variable I recommended above, then you can use the Output of the variable as the Input for this field.
Email Activity Regarding Record
Next, the Email Activity record needs to be linked (regarding) a record. In this scenario, it will be linked to a case record. For example, if the trigger of the flow is when a Case is assigned to someone (owner changes), then you can reference the Case GUID (unique ID) in the below field.
The reason for having "incidents(Case)" in the field, is that the regarding field needs an entity reference along with the GUID. The underlying name for the Case entity is "incidents".
Email Subject
Now, the Subject of the email needs to be populated. You will notice I used another variable for this. However, you don't need to do this. You can use plain text here if you want to keep things simple.
Sending the email
The last part of this process is to actually send the email. This is done using a the "Send Email" bound action that is part of the "CDS (current environment)" connector. Below is an example of this action.
This action has a few parts to cover.
Entity name - This is the entity that correlates to the same entity of the "create record" action. In that step we created an "Email Message" record.
Action name - There will be a drop-down list that corresponds to the "Entity name" chosen.
Item ID - This will be the GUID (unique ID) of the record to send. In this case, it will be the prior action of the "Email Message" record that was created.
IssueSend - This is a No/Yes option list. If this is set to "no", the email will not send. Be sure you set this to "yes" for the email to send.
In Conclusion
While the Power Automate process may not be as straightforward as the classic workflow, it does open up other opportunities. It can allow more flexibility in the dynamic content, related records that can be referenced, and any conditions you may need.
Yes, Power Automate may seem intimidating at first if you haven't used it before, but keep practicing. At some point the classic workflows may be deprecated, but this is unknown at this time. This is a topic for another time and place.
Until next time...
Aaron Back is a Microsoft MVP with many years' experience with Microsoft Dynamics 365 (CRM), Power Apps, Power Automate (Flow), and Power BI. He is actively involved with the Microsoft Dynamics 365 UG (D365UG) (User Group) Community. His involvement includes: Serving as Chapter Leader for his local D365UG Chapter, serving on the D365UG Board of Advisors, and speaking at the annual D365UG Summit conference.
ACE Microtechnology, Inc. is a professional services firm committed to delivering Dynamics 365 (CRM) business solutions to small and medium sized organizations. Our focus is on delivering products and services that improve our clients’ business operations. ACE has developed specialties in serving the lite manufacturing, distribution and the hospitality industry.
Rather than just building technology or implementing software, we deliver real business value through industry knowledge and understanding each client’s business. We make it our business to know your business.
For more information or assistance with Dynamics 365 (CRM) contact ACE!
Debra - Yes, you should be able to use a mailbox (email address). Just be sure to check if the "send on behalf of" settings are set up correctly. I would suggest setting up a simple flow to test this out.
Debra
Thanks for the quick reply.
How would I format the From as I tried just adding the email address [email protected] but got the following error:
Simon / Debra - The "To" field needs to have the plural entity name follow by the GUID within parentheses. I have a screen shot within the blog post with an example. It's in the "Email Activity Parties" section.
Simon
I'm having the same issue as Debra, I just want to 'send to' the same inbox every time this flow is triggered, but simply inputting the email address doesn't work. I get the error "Resource not found for the segment"
Timothy Meredith
Easy workaround for anyone who like me made a whole flow and realized you couldn't tag parties, without having to export and import to a solution or recreate in a "Solution" to have the appropriate connector.
Just go make a blank flow in solution, add the right create record CDS current environment action that shows the json activity party. Click 3 dots then use the new "copy action" feature, and go to the next tab with your current flow that is not in the solution and paste the action there. It will place the "current environment" action into a flow that is not in a solution.
The only problem I ran into is I could not tag regarding correct, it error'd couldnt find GUID. So I just added a normal update record CDS from normal connector and tagged regarding that way.
Probably will break whenever MS actually updates the normal CDS connector if they ever do, but until then it is working fine.
Timothy - The "regarding" fields are a little odd to work with. If you are using the CDS (current environment) connector, the "regarding" fields typically have a specific layout. For example, if you need to set the User in a regarding field, the layout would be:
systemusers(GUID)
Replace the "GUID" with the ID (GUID) from a prior step in the flow.
If you run a flow to test it, look at a successful run and look at the output. This will help with the field/value output to know how to construct the inputs for later steps.
Dave Smith
Hi,
Do appreciate your responses.
I had another quick question, I was wondering within the triggers we created in this tutorial are we able to change the "Owner" of the Email record to something else or someone else?
I believe somewhere perhaps in the CDS (Current Environment) the owninguser or ownerid
if not what will be the best practice for to change this?
Dave - You may need to use add an extra step using the CDS connector (not the Current Environment one) to update the Owner. Just an idea of something to test.
Dave Smith
Sorry me again, appreciating your responses,
Another quick question, in regards to the "Create a Email" record do I leave the "From" populated in value 2 Activity party as systemusers(User)? or do I also have to somehow populate/set the GUID in here to of the shared email account where I want the emails to go out from?
Kind regards.
Dave Smith
When you say
"you can add a prior step of “Get Record”. In the ID field, paste in the GUID of the special account"
Do you mean add another "Get Record" Step, and paste in a guid, please confirm the syntax is it:
Dave - To answer you to posts:
First, I would input the GUID as the option 1 for the "Get Record" step.
Second, the "From" field would be set to using the "Get Record" reference. You would put in: systemusers()
> The would be the a Dynamic Content value from the "Get Record" step.
> The reason for using a "Get Record" step is if the user record should change in the future, you would only need to update the 1 "Get Record" step and the down-stream steps would not have to be updated.
Dave Smith
Great article, excellent stuff a quick question wondering on the following:
I understand in the "From" is which account will be sending out the email.
I have a special user account set up already that is sending out the classic workflow emails via the CRM, however my question was, what solution is there to send emails "From" that same special account?, I guess I will need to somehow pass in that special account value dynamically inside the flow? Any advise on this?
Dave - You can add a prior step of "Get Record". In the ID field, paste in the GUID of the special account. You can find this by going to https://admin.powerplatform.com. This will open the new Power Platform Admin Center (PPAC). Under "Environments", select the appropriate one. Then, at the top, click on "Settings". Next, expand "Users + permissions" and click on "Users". Once the list of Users loads, click on the name and it will open a new window. In the new window, look at the URL. At the end there will be an ID for the record. Copy this ID and paste it into the flow ID field.
Umer Javed
Hi Aaron,
Thanks for the article. When i choose the "Email Messages" as Entity Name, i am not able to see the drop-down for the attributes to choose the “From” and “To” and “CC”. There is no small “T” icon either to the right of section. Any idea why this is the case please?
I am using CDS connector using "Current environment". It's a simple flow to trigger on create/update of opportunity therefore send an email.
Thanks
Umer - I'm not sure why that is happening. I would have to physically see the flow to troubleshoot it. I apologize.
Umer Javed
Hi Aaron,
No problem i resolved it, actually i had picked up "Common data service" only connector by mistake. I hope Microsoft will resolve the confusion by providing full parity in latest connector(Common data service current) so we only have one to pick going forward.
Thanks
Aidan O'Kane
Hi Aaron, thank you very much for your article. I was able to get through every step with the flow working and sending emails. I'm hoping this is a simple question you can help with. I was curious to find out if it is possible to set the 'To' field to a Distributed List or personal email instead of user or contact record? We send a lot emails to distrusted lists, as it is easier to manage the list in outlook instead updating workflows every-time a person gets rolled on or off that email chain. I am able to set the 'To' field to any email address using traditional workflows. I was testing with my personal email (Not in CRM) in Power Automate would get this error "Resource not found for the segment 'My Personal email'". Any insight would be very much appreciated. Thank you
Rod McBride
Thanks for the article Aaron. I can create a new Email Message Record, but cannot find the 'Send Email' action as depicted in your post. Am I missing something or has there been a change to the available CDS actions in Power Automate?
I can send an email using O365 Outlook connector, but then it's not tracked in Dynamics.
Rod - The "Send Email" action is an option of the "Bound Action" step. Remember, you will need to create the flow from a solution file in CDS. I have a link in the article to the Microsoft information on the "Bound Action".
To address you O365 Outlook connector: Yes, it's not tracked in Dynamics as the email is sent through Outlook/Exchange. Using the "Bound Action" "Send Email" option, will send the email through Dynamics. The "Send Email" uses the email created in the prior step. The email created in Dynamics is associated with a record (regarding).
Rod
Hi Aaron,
Please would you assist in providing a larger screenshot of the top of your flow. Where it show the actual event, are you using an Update record/create record?
I have hunted high and low and am unable to locate the ActivityParty properties as you have shown in your example. I am also unable to find the 'Send Email' action as you have stated above.
Are you using a custom connector or the standard CDS connector.
Your help is always really appreciated.
Thank you
Rod - In the "Creating the email message" section of my article, I mention that I am using the "Create Record" action. After selecting this action, choose the "Email Messages" entity.
Stephen
It appears, Flows created inside a Solution do not currently show as On Demand Flows on an entity record.
And unfortunately party lists are not supported on the CDS connector outside a solution.
Thank you very much for your article. I struggled with the standard Dynamics 365 and CDS connectors for many days until finding your article. I am very grateful.
Are we able to send emails from a QUEUE? We have a shared mailbox we wish to send emails from. I created a Queue for it and have enabled and tested the Mailbox. However, the Power Automate flow throws an error saying there is no relationship between queues and activity parties. What solution is there to send emails from a Shared Email address?
Debra
Hi Daniel,
did you manage to resolve this?
Debra
Ben Girard
Amazing article!! Thanks for taking the time to create it. Been wanting to setup such a process for a long time, but never thought CDS/Flow would get there.
I'm struggling with adding the To and From field in the email. I have followed your instructions, but I cannot find where to create the Activity Party Attributes. The screenshot is cropped too tight.
Ben - The Activity Party fields should appear when you choose "Email Messages" as the "Entity name". There is a drop-down for the attributes to choose the "From" and "To" and "CC". If you aren't seeing these field options, click on the small "T" icon to the right of section. This will toggle between the JSON layout and the field layout.
The values to enter into the Activity Party fields are pulled from the prior Power Automate steps. These in put in using the Dynamic Content option. Also, be sure to include the Schema name of the entity as a prefix and the Dynamic Content GUID in between the parentheses.
I would suggest you test things with a single Activity Party, such as "TO", to ensure things are working. Keep in mind that the root functionality will the same as using the "classic" workflows in Dynamics 365. You will need to be sure that you have an outbound email ("FROM") that is set up with the Mailbox Tested & Enabled. Lastly, if you are using a true User Account and not a Queue account, then the User will need to have the Personal Options checked for "Allow other Microsoft Dynamics 365 users to send email on your behalf".
Comments are closed.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Hi,
can the "From" be from a mailbox rather than a user as that's how we need to send the emails out?
Debra
Debra - Yes, you should be able to use a mailbox (email address). Just be sure to check if the "send on behalf of" settings are set up correctly. I would suggest setting up a simple flow to test this out.
Thanks for the quick reply.
How would I format the From as I tried just adding the email address [email protected] but got the following error:
Action 'Create_a_new_record' failed
Resource not found for the segment '[email protected]'.
I have tried using
queues(GUID)
but the error is now
Bad Request - Error in query syntax
Hi Debra,
Did you find a solution to sending an email to a direct mailbox address?
Simon / Debra - The "To" field needs to have the plural entity name follow by the GUID within parentheses. I have a screen shot within the blog post with an example. It's in the "Email Activity Parties" section.
I'm having the same issue as Debra, I just want to 'send to' the same inbox every time this flow is triggered, but simply inputting the email address doesn't work. I get the error "Resource not found for the segment"
Easy workaround for anyone who like me made a whole flow and realized you couldn't tag parties, without having to export and import to a solution or recreate in a "Solution" to have the appropriate connector.
Just go make a blank flow in solution, add the right create record CDS current environment action that shows the json activity party. Click 3 dots then use the new "copy action" feature, and go to the next tab with your current flow that is not in the solution and paste the action there. It will place the "current environment" action into a flow that is not in a solution.
The only problem I ran into is I could not tag regarding correct, it error'd couldnt find GUID. So I just added a normal update record CDS from normal connector and tagged regarding that way.
Probably will break whenever MS actually updates the normal CDS connector if they ever do, but until then it is working fine.
Timothy - The "regarding" fields are a little odd to work with. If you are using the CDS (current environment) connector, the "regarding" fields typically have a specific layout. For example, if you need to set the User in a regarding field, the layout would be:
systemusers(GUID)
Replace the "GUID" with the ID (GUID) from a prior step in the flow.
If you run a flow to test it, look at a successful run and look at the output. This will help with the field/value output to know how to construct the inputs for later steps.
Hi,
Do appreciate your responses.
I had another quick question, I was wondering within the triggers we created in this tutorial are we able to change the "Owner" of the Email record to something else or someone else?
I believe somewhere perhaps in the CDS (Current Environment) the owninguser or ownerid
if not what will be the best practice for to change this?
Looking forward to your suggestion.
Dave
Dave - You may need to use add an extra step using the CDS connector (not the Current Environment one) to update the Owner. Just an idea of something to test.
Sorry me again, appreciating your responses,
Another quick question, in regards to the "Create a Email" record do I leave the "From" populated in value 2 Activity party as systemusers(User)? or do I also have to somehow populate/set the GUID in here to of the shared email account where I want the emails to go out from?
Kind regards.
When you say
"you can add a prior step of “Get Record”. In the ID field, paste in the GUID of the special account"
Do you mean add another "Get Record" Step, and paste in a guid, please confirm the syntax is it:
1. 1834a629-7237-4e56-9063-68b24b13f9f3
2. (1834a629-7237-4e56-9063-68b24b13f9f3)
3. id=1834a629-7237-4e56-9063-68b24b13f9f3
Dave - To answer you to posts:) would be the a Dynamic Content value from the "Get Record" step.
First, I would input the GUID as the option 1 for the "Get Record" step.
Second, the "From" field would be set to using the "Get Record" reference. You would put in: systemusers(
> The
> The reason for using a "Get Record" step is if the user record should change in the future, you would only need to update the 1 "Get Record" step and the down-stream steps would not have to be updated.
Great article, excellent stuff a quick question wondering on the following:
I understand in the "From" is which account will be sending out the email.
I have a special user account set up already that is sending out the classic workflow emails via the CRM, however my question was, what solution is there to send emails "From" that same special account?, I guess I will need to somehow pass in that special account value dynamically inside the flow? Any advise on this?
Thanks.
Dave - You can add a prior step of "Get Record". In the ID field, paste in the GUID of the special account. You can find this by going tohttps://admin.powerplatform.com . This will open the new Power Platform Admin Center (PPAC). Under "Environments", select the appropriate one. Then, at the top, click on "Settings". Next, expand "Users + permissions" and click on "Users". Once the list of Users loads, click on the name and it will open a new window. In the new window, look at the URL. At the end there will be an ID for the record. Copy this ID and paste it into the flow ID field.
Hi Aaron,
Thanks for the article. When i choose the "Email Messages" as Entity Name, i am not able to see the drop-down for the attributes to choose the “From” and “To” and “CC”. There is no small “T” icon either to the right of section. Any idea why this is the case please?
I am using CDS connector using "Current environment". It's a simple flow to trigger on create/update of opportunity therefore send an email.
Thanks
Umer - I'm not sure why that is happening. I would have to physically see the flow to troubleshoot it. I apologize.
Hi Aaron,
No problem i resolved it, actually i had picked up "Common data service" only connector by mistake. I hope Microsoft will resolve the confusion by providing full parity in latest connector(Common data service current) so we only have one to pick going forward.
Thanks
Hi Aaron, thank you very much for your article. I was able to get through every step with the flow working and sending emails. I'm hoping this is a simple question you can help with. I was curious to find out if it is possible to set the 'To' field to a Distributed List or personal email instead of user or contact record? We send a lot emails to distrusted lists, as it is easier to manage the list in outlook instead updating workflows every-time a person gets rolled on or off that email chain. I am able to set the 'To' field to any email address using traditional workflows. I was testing with my personal email (Not in CRM) in Power Automate would get this error "Resource not found for the segment 'My Personal email'". Any insight would be very much appreciated. Thank you
Thanks for the article Aaron. I can create a new Email Message Record, but cannot find the 'Send Email' action as depicted in your post. Am I missing something or has there been a change to the available CDS actions in Power Automate?
I can send an email using O365 Outlook connector, but then it's not tracked in Dynamics.
Rod - The "Send Email" action is an option of the "Bound Action" step. Remember, you will need to create the flow from a solution file in CDS. I have a link in the article to the Microsoft information on the "Bound Action".
To address you O365 Outlook connector: Yes, it's not tracked in Dynamics as the email is sent through Outlook/Exchange. Using the "Bound Action" "Send Email" option, will send the email through Dynamics. The "Send Email" uses the email created in the prior step. The email created in Dynamics is associated with a record (regarding).
Hi Aaron,
Please would you assist in providing a larger screenshot of the top of your flow. Where it show the actual event, are you using an Update record/create record?
I have hunted high and low and am unable to locate the ActivityParty properties as you have shown in your example. I am also unable to find the 'Send Email' action as you have stated above.
Are you using a custom connector or the standard CDS connector.
Your help is always really appreciated.
Thank you
Rod - In the "Creating the email message" section of my article, I mention that I am using the "Create Record" action. After selecting this action, choose the "Email Messages" entity.
It appears, Flows created inside a Solution do not currently show as On Demand Flows on an entity record.
And unfortunately party lists are not supported on the CDS connector outside a solution.
Completely broken Microsoft.
Stephen - I believe this is something that Microsoft is working on. I'm not sure of the timing any updates at this time.
Thank you very much for your article. I struggled with the standard Dynamics 365 and CDS connectors for many days until finding your article. I am very grateful.
Are we able to send emails from a QUEUE? We have a shared mailbox we wish to send emails from. I created a Queue for it and have enabled and tested the Mailbox. However, the Power Automate flow throws an error saying there is no relationship between queues and activity parties. What solution is there to send emails from a Shared Email address?
Hi Daniel,
did you manage to resolve this?
Debra
Amazing article!! Thanks for taking the time to create it. Been wanting to setup such a process for a long time, but never thought CDS/Flow would get there.
I'm struggling with adding the To and From field in the email. I have followed your instructions, but I cannot find where to create the Activity Party Attributes. The screenshot is cropped too tight.
I'd love to hear back from you...Thanks.
Ben - The Activity Party fields should appear when you choose "Email Messages" as the "Entity name". There is a drop-down for the attributes to choose the "From" and "To" and "CC". If you aren't seeing these field options, click on the small "T" icon to the right of section. This will toggle between the JSON layout and the field layout.
The values to enter into the Activity Party fields are pulled from the prior Power Automate steps. These in put in using the Dynamic Content option. Also, be sure to include the Schema name of the entity as a prefix and the Dynamic Content GUID in between the parentheses.
I would suggest you test things with a single Activity Party, such as "TO", to ensure things are working. Keep in mind that the root functionality will the same as using the "classic" workflows in Dynamics 365. You will need to be sure that you have an outbound email ("FROM") that is set up with the Mailbox Tested & Enabled. Lastly, if you are using a true User Account and not a Queue account, then the User will need to have the Personal Options checked for "Allow other Microsoft Dynamics 365 users to send email on your behalf".