cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Julien2
Super User
Super User

Saving Attachments to Notes from Outlook in Cases Entity

Hello,

I have created a flow which is about the following:


-When a new email arrives, based on some conditions a new record will be created in the Cases entity.

In Dynamics CRM 365, the attachments are stored in the "Notes" entity, and for each case, the attached images will display in the "Notes" navigation.

Capture.PNG

What I want to achieve is the following:

- When a new email arrives contains attachments, and the case is created, I would like to display in the "Notes" navigation the attached images that was sent from the email.

 

Please have a look at the entire flow screenshot:

Capture1.PNGCapture2.PNG
What should be the Regarding ID, and the Regarding Type of the Notes create record action?

Can you please provide an example and explain in detail to achieve the following scenario?

Any help will be greatly appreciated.
Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Julien2 

 

You need to set the newly created Case Id under Regarding and Regarding Type as incidents.

 

In your logic (First screen shot you provided), if you have multiple attachments you might end up creating more than one case record. So to avoid that you probably need another flag to check whether the record is already created or not. Set a Boolean flag to check this. Hope it make sense.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

12 REPLIES 12
abm
Super User
Super User

Hi @Julien2 

 

Regarding Id is the Identifier (GUID) of that CRM record where  you are trying to attach to. So if it's an account or contact that GUID you need to set to and type to set as account or contact or name of the entity.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hello @abm ,

 

I have set the Regrading ID to my own GUID and as a contact regarding type.
Unfortunately, the flow fails on the Document field and says that the document body contains one or more invalid characters that are right in the result.

Capture3.PNG

Do I have to encode the attachments contents type by using base64() expression?
If yes, what would be this expression?

Looking forward to your response.
Thank you!

Yes you need to encode using base64()

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm,

 

I have used the following expression and now the flow runs successfully.

base64('ContentBytes')

 Unfortunately, when I have checked the case that was created from this flow the Notes still empty and the attached image did not show. I believe because of the GUID I have entered and the regarding type that I have chosen.

I have tried to select for the GUID the "CASE ID" from the record created and as a regard type, I don't know what I should choose because I didn't find something related to the Cases entity.

 

Any suggestions?

Thank you.

abm
Super User
Super User

Will post you something soon



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @Julien2 ,
 
Try to convert to string. See below screenshot. Here I have two compose. One for getting the filename and other for contents.
 
For file content compose use the below expression.
 
string(items('Apply_to_each')?['ContentBytes'])]
 
image.png
I have tested this and it is working as expected.
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
abm
Super User
Super User

Hi @Julien2 

 

You need to set the newly created Case Id under Regarding and Regarding Type as incidents.

 

In your logic (First screen shot you provided), if you have multiple attachments you might end up creating more than one case record. So to avoid that you probably need another flag to check whether the record is already created or not. Set a Boolean flag to check this. Hope it make sense.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hello @abm ,
Thank you for providing an example.
Exactly, so maybe the user will attach more than one image or document.


I have initialized a boolean variable at the top and created a condition if it's equal to true. But inside this condition which action should be there?

Capture1.PNG

Capture.PNG

I would like to ask if you could provide an example of this so I can quietly understand this.

Thanks again!

Hi @Julien2 

 

Before your create new record (case) you need to add an If condition action to check this new flag is false or not. Then move the current create case action under the Yes condition. Once the new case is created set the flag to true so that it won't execute two times.  

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm ,

I have followed what you mentioned and make the changes.
Please have a look below to make sure that I did everything right.

Capture.PNG

Looking forward to your response.
Thank you.

Hi @Julien2 

 

Yes that looks ok to me. Test this and find out whether everything is working as expected.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm ,

 

Thank you very much for your support, worked as expected!

 

Here are the results:

Capture.PNGCapture1.PNG

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,639)