Blog-Image

Move attachments from D365 to SharePoint & provide convenient link on Email and Delete Attachments in CRM by using Power Automate

Step 1:
Create a blank Flow template. Choose the Dynamics 365 Connector and trigger as, “When a row is added, modified or deleted”.
Select your Organization Name, and the entity, in our case it is Email Messages.

PowerAutomate Image

Step 2:
Adding Initialize variable for links
Select Name as Links and its type is string
Without adding the value, we didn’t get the proper way for Links in CRM Email Body. Because we are adding value for CRM Email Body. By adding <br /> break tag we will get step by step links in Email Body

PowerAutomate Image

Step 3::
First chose the Microsoft Data verse then add the List Rows
We can select Attachments for Table Name after that we can filter the row and select Email Message
before that we add _objectid_value eq. This is for is email message is equal for object id value.

PowerAutomate Image

Step 4:
In this step 4 we can have 4 steps
1) Create File
2) Create Sharing Link for a File or Folder
3) Append to string Variable
4) Delete a Row
These 4 steps are involved in the Apply to Each step
In this step we can select the Apply to each and select Value for Output from previous steps

PowerAutomate Image

Step 4.1:
In this we can Select Create File from SharePoint
We can add our Site Address, Folder path is Shared Documents, chose the file name and file Content

PowerAutomate Image

Step 4.2:
We can add Create Sharing link for a file or Folder from SharePoint
In this we can add Site Address, Library Name is Documents, Item Id is Itemid only we can select from SharePoint only, In Link Type we can select view only or View and Edit and Link Scope

PowerAutomate Image

Step 4.3:
We can Add Append to String Variable
In this select Name as Links and the value for sharing links and showing file name or showing links also
<a href=”Sharing Link”>"File Name"</a><br/> (this show the File Name)
<a href=”Sharing Link”>"Sharing Link"</a><br/> (this will show the file link )

PowerAutomate Image

Step 4.4:
And the last one we can Delete the Email Attachment in CRM
We can Add the Delete a Row in Microsoft Dataverse
In this select Table name as Attachments and we can select Row ID is Activity Mime Attachments in List Rows

PowerAutomate Image

Step 5:
We can Add a condition If the Links are not Equal to the Attachments <br /> then update the
Email Message
Links is != to Attachments then select If Yes and Update a Row

PowerAutomate Image

In the first we select Microsoft Data verse and select Update a Row
The Table name is Email Message, Row ID is same as Table name Bcz we are Updating this Table and Row ID after that we will go to Advance Option, we will get more options. In this Description we can Add Description and Links

PowerAutomate Image
quote-image

Move attachments from D365 to SharePoint & provide convenient link on Email and Delete Attachments in CRM by using Power Automate

Ramesh, Cloud Solution Specialist
We Are IZENIX SOLUTIONS

We Work to Help You Grow

Izenix educate and explain practical performance and configurations for fast check and best outcomes

Implementation
100%
Training
100%
Support
100%
We Are Here For You

Let’s Get Back to Work

Getting a better understanding of Izenix's specialized services and solutions

Schedule for Free Demo