CRM Software Logo

Microsoft Dynamics 365 & Dynamics CRM experts provide reviews and opinions to aid professionals with the Dynamics 365 selection process.

 
 
ACE Microtechnology

Send Dynamics 365 Emails from Power Automate

Email | Print

Aaron Back, Microsoft MVP

Setting the stage

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.
Classic workflow send email

 

The next step would be to customize the email message.
Classic workflow send email - update 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.

  • Navigate to https://flow.microsoft.com
  • Log in with your credentials
  • Click "Solutions" on the left
  • 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.

Power Automate - Create Solution

 

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.
Power Automate - Create flow within solution

 

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.

Power Automate - CDS current environment trigger

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".
Power Automate - Search for variable actions

In the list above, the "initialize variable" is listed. Choose this option to start creating the variable.
Power Automate - Variable Email Message

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.
Power Automate - Set variable Email 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.
Power Automate - Get contact record

Power Automate - Get 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.

Power Automate - Create Email Message recipients

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.

Power Automate - Create Email Message Description

 

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.

Power Automate - Create Email Message Subject

 

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.

Power Automate - Send Email Bound 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!

30 Responses to “Send Dynamics 365 Emails from Power Automate”

  1. Debra says:

    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.

      • Debra says:

        Thanks for the quick reply.

        How would I format the From as I tried just adding the email address enquiries@businesssupporthelpline.org but got the following error:

        Action ‘Create_a_new_record’ failed

        Resource not found for the segment ‘enquiries@businesssupporthelpline.org’.

      • Debra says:

        I have tried using

        queues(GUID)

        but the error is now
        Bad Request – Error in query syntax

      • Simon says:

        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”

  2. Timothy Meredith says:

    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.

  3. Dave Smith says:

    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

  4. Dave Smith says:

    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.

  5. Dave Smith says:

    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:
      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.

  6. Dave Smith says:

    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 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.

  7. Umer Javed says:

    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 says:

        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

  8. Aidan O'Kane says:

    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

  9. Rod McBride says:

    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).

  10. Rod says:

    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.

  11. Stephen says:

    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.

  12. 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?

  13. Ben Girard says:

    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”.

Ask This Expert a Question / Leave a Comment

 

 
 
Show Buttons
Hide Buttons