Microsoft Power Automate has come a long way since its introduction in 2016. More connectors are available than ever before and Microsoft is paving the way for Power Automate to be the future of workflows in D365. A common occurrence is the need to automate sending emails and this can easily be accomplished using the Microsoft (Office) 365 Outlook connector. But what about tracking those emails to records in D365?
Power Automate is a very effective tool that Microsoft has poised to replace workflows in D365 at some point as evidenced by the message displayed when creating a workflow, “We recommend using Microsoft Flow instead of background workflows. Click here to start building Flows!” And why not? Power Automate is expanding its abilities all the time and can connect to apps outside of the Microsoft ecosystem. Power Automate eliminates the need to hire a developer to write complex code for integrations that perform simple tasks like updating records or changing statuses.
While Power Automate is a robust tool with ever-expanding capabilities, it also handles simple tasks with grace. A universal business need for many organizations is the ability to automate email notifications based on certain criteria: an opportunity is won, send an email to the sales manager; a case is closed, send an email to the customer; a work order is completed, send an email to the customer. Power Automate can easily accommodate this using the Microsoft 365 Outlook connector.
That looks nice and simple and even appears similar to Outlook when composing an email. But where is the “Regarding” field so it can be tracked against the opportunity? It’s important to track communication related to the record so the full picture is available to anyone viewing the record. Presently, there is not an option to set an email regarding a D365 record using the Microsoft 365 Outlook connector.
However, there is a way to accomplish this using a different approach. The trigger can remain the same, in this case the Common Data Service (current environment) trigger for when an opportunity is updated. The action step is where process varies. Before creating the email, there are some values that will need to be prepared.
The first step, Get a record, provides data from the user, or owner of the opportunity record. The second step, Initialize variable, is used to capture the link to the opportunity record so it can be used in the body of the email.
Next, the email is created. Instead of using the Microsoft 365 Outlook connector, select the Common Data Service (current environment) connector with the “Create a new record” action.
Now the email can be created. Using the data from the user record, the manager can be listed as the recipient of the email.
Then the body is populated using values from the user record and the opportunity record as well as the link to the opportunity that was initialized in the prior step.
The most important part of the email creation step is to set the email regarding the opportunity. To accomplish this, simply scroll to the corresponding Regarding field and enter the record ID.
Don’t forget the subject!
The last step in the process is to send the email. This is done by selecting the Common Data Service (current environment) connector and choosing the “Perform a bound action” action.
Select the Email Messages entity. This will provide a set of actions available to this specific entity. Choose SendEmail, set the Item ID to the email message ID, and set IssueSend to Yes.
That is it! That’s the whole process. The email will now be tracked to the opportunity record. This process will work for sending emails and tracking them against any record. Some additional steps may need to be added before creating the email if more information is needed.