Tue, 04/13/2021 - 09:47 By Nguyen Thanh Khoi Reviewed By Lloyd Sebag
Dynamics 365 share record content via email

Dynamics 365 share record content via email:

1. Introduction

Let's have an example that you want to share information of a record (account, contact, activity, ...) to a person who can't view the record in CRM due to some issues (such as security, system issue, ...) or he doesn't have access to CRM because organization want to minimize the number of users. Hence, I would like to propose a solution: Implement a Power Automate that will capture all information of record then send it to the receiver via email and in this article, I will show you how to implement an on-demand Power Automate to achieve the requirement as well as how to get Dynamics 365 attachments and my experience in Power Automate.

You can read this chronicle about Power Automate 

Prerequisite: you must have basic knowledge about MS Power Automate, you could find it here.


  • Enable On-demand MS Power Automate
  • Enable MS Power Automate
  • How to get Dynamics attachments in MS Power Automate
  • Share record information to a user via email

2. Enable On-demand Power Automate

The purpose of this step is to enable button Flow in Dynamics form. After activation is done, there is a button that will display in form as following:

example on demand flow

If your Dynamics 365 version contains the October 2019 update, you could skip this step because it's enabled already.

  • Navigate to Setting -> Administration -> System Settings -> Customization then click on "Yes" under "Enable Microsoft Flow". You can't change it to No once it's enabled.
enable MS Flow
  • Open Power Platform Admin Center then select environment name -> Settings -> Product -> Behavior and make sure that "Show Power Automate on forms and in the site map" is turned on.
enable in Power Platform Admin Center

3. How to get Dynamics 365 attachment in Power Automate

First, It is very common when an activity record contains attachments so we need to know how to get Dynamics 365 attachments from Microsoft Power Automate.

Because attachments are stored in notes and displayed in the Timeline section of the activity record, we must retrieve notes associated with the activity record and we could get attachment content from the Note. Since there are a couple of attachments related to a record, we need a variable to store all attachment content.

  • Initial variable to store all attachment content:
initial variable
  • Select action List rows then config for "Filter Query" as following

Get list notes

  • Loop each note to get the content of Attachments and store to array Attachment content.
Check if note contain attachment

Now we have all attachments related activity in variable "lstAttachment", you could use this attachment to upload a file to another system such as "Blob Storage" or send an email with attachments, ...

4. Share Phonecall information to a user via email

The idea is to capture all information of phone call and put them to email body and append it with the attachments we retrieved in previous steps.

Besides that, I propose to create an email template with a HTML page and store it in a technical config entity. It will not only gives an interactive view to the users but also simplify the maintenance when we want to apply some modifications.

The picture below show how we store the template and give a preview on the final rendering.

template HTML

Then, the steps will be:

  • Create on-demand Power Automate: create an instant Cloud Flow and choose the trigger  "When a row is selected". In this case we don't need any more input for the trigger
Create instant flow
  • Get email template from technical config entity: use action "List rows" to retrieve email template from technical config entity. As you could see, there is a field name "new_key" in the technical config entity to store the key. Although there is only one config record to store the PhoneCall template email, I must use a loop to get this record because the output of action "List rows" is an array.


Record config


Get template from config
  • Get information of phone call: use the action "Get row" and config Phone call ID as input. In this step, you could see that we are able to get the field's value of Phone call from the output of action "When a record is selected" and a question is risen in your mind "Why do we need to retrieve again record?". The reason is: the output of "When a record is selected" doesn't contain full attributes in case the entity has a lot of fields.
Get Rows

Please have a look at the trick How to get optionset's label, name of a lookup value in Flow

  • Get attachments of phone call: as explained previously
  • Send email: use action Send an email (V2), you could find the detail from MS document

Configuration for Send Email :

- To: address of receiver email. In my example, I send it to the person who runs the Power Automate

- Body: strEmailContent is a string of email template stored in the technical config then replace with data of phone call record

- Attachments: press the button on the right side to switch to the entire array then put value of list attachments content

Send email


Here is the final result from the received email when the PA ran:


5. Conclusion:

Here is an example showing how to leverage Power Automate to adapt the requirements and some tips from my experience while doing projects. Do you have another idea to meet the requirement or your tips, let drop a comment to discuss :).

DC Event ZH2023

The subscriber's email address.

Besides that, MS Power Automate is a very powerful tool that MS provide to User in a various useful case with the purpose to reduce code at least at possible.

Dynamics 365 share record content via email


Is there any extra license required to use Power Automate in D365 Sales?

Mon, 05/24/2021 - 16:05
Amanda Wu (not verified)

Hi Amanda Wu,

Most of flow I used in this article is standard flow and no need extra license. However, Microsoft update these flow frequently because it is still new feature and need improving and they could merge some trigers to one or separate it. If you could not find these triggers (or actions), please try to search it by some input such as "when selected record" or try to create a flow inside a solution (some action/trigger just exist when you create a flow inside solution).

Hope it could help you.




Tue, 05/25/2021 - 11:15

In reply to by Amanda Wu (not verified)

Add new comment

Enter the characters shown in the image.