- Print
- DarkLight
- PDF
Writing Email Attachments to Common Data Service Notes Entity
- Print
- DarkLight
- PDF
A common scenario when you are managing customers is the ability to receive email attachments from them and then be able to add them to your Customer Relationship Management (CRM) system such as Dynamics 365. This allows you to centralize all communications from your customer and make it easy to find it.
We can automate this process of adding attachments from our customer by using Power Automate and that will be the focus of this post.
- To start with, we will use the Office 365 Outlook connector and the When a new email arrives (V3) trigger. As part of our trigger configuration, we need to set Include Attachments to Yes and Only with Attachments to Yes. This will ensure we only process emails that have attachments.
- Next, we will add the Common Data Service (current environment) connector and the Create a new record action.
- We now need to configure this action and will do so by assigning the following values:
• Entity name – Notes
• Title – New Attachment (or whatever value you prefer)
• Description – New Attachment (or whatever value you prefer)
• Is Document – Yes
• Document - Here we will use an expression of: decodeBase64(base64(items('Apply_to_each')?['contentBytes']))
• File Name – Attachments Name
• File Name – Attachments Name
• Mime Type – Attachments Content Type
Testing
We can now go ahead and test our flow by sending in an email attachment to the inbox that our Power Automate flow is monitoring. When we process this email, we will discover that a new record has been added to our Note entity and that our attachment is available.
Special thanks to Phil Topness who helped me troubleshoot this scenario.