cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bradlaw
Microsoft
Microsoft

How do I Access Dynamics 365 attachments (Leads) from Notes (Annotations) via Power Automate?

I have a Portal Contact Us Page that accepts attachments that make their way into the Lead entity. I pick up the new Lead entry in Power Automate and I sent an email to users using an Outlook Connector to create a new email. I have the email set up as you can see in the image but I cannot figure out how to access the <NOTES (Annocations) Table >to either add the attachment to the email in Power Automate?

 

What steps are necessary in Power Automate to add the atachment into the email I am generating? 

 

2022-03-08_10-43-19.gif

8 REPLIES 8
rampprakash
Super User
Super User

Hello @bradlaw 

 

Hope you are doing good.

 

Steps to Follow:

 

1. List Rows for Notes

    Filter _regardingobjectid_value eq 'LeadId'

2. Get the File Content and File Name and use it 🙂

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

@rampprakash,

 

Thanks so here is what I have, where can I verify the syntax of the filter? I just cannot seem to get the filter correct? Also ocne I get this correct, do I get the File Content and File Name by initilizing them as variables?

 

2022-03-08_13-29-33.gif

 

 

2022-03-08_13-28-12.gif

 

 

 

 

Prakash4691
Super User
Super User

@bradlaw ,

For filter rows the field you need to include is _objectid_value eq 'leadid', leadid should be from previous request. To get exact content of attachment compose an action. If there are multiple mime types involved kindly add condition to check for diff types. While sending an email, for attachment content include output of compose and file name from notes.

 

I will include couple of screenshots for your reference.

 

If it answers your question, kindly give kudo and accept it as solution.

 

Prakash4691_0-1646789318505.png

Prakash4691_2-1646789506363.png

 

 

Regards,

Prakash

@rampprakash,

 

Good news is I was able to follow your instructions and I am receiving an errors when running the flow. My attachment has a ".txt" attachment I assume it needs to be based on the Compose step you suggested?

 

The error is 

 

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The repetition action(s) 'Apply_to_each_-_Utilize_Document_and_Send_Email' referenced by 'inputs' in action 'Compose' are not defined in the template.'.'."}}". Code: 0x80060467 InnerError: '.

 

 

2022-03-09_16-13-55.gif

2022-03-09_16-14-18.gif

 

 

 

 

@bradlaw ,

Check output of compose action whether you can able to see base64 string of file content. If it is a txt file then content type is fine or else as I mentioned earlier for different file type you need to add condition and change the content type accordingly.

 

Regards,

Prakash

Ok. Yes, this was a text file attachment. I'll take a look.

Thank you both, I still do not have this working correctly. It runs just fine with these final steps but I don't get an email from the Apply All Step? The normal send email does work above the Apply All email send however?

 

when these two send emails are in the same flow, the first one without the Apply All does send an email. The second one with the Appy to All does not send an email. 

2022-03-11_21-36-04.gif

 

Even when I add the suggested Compose content like this it does not work.

 

bradlaw_0-1647053513863.png

 

This one does appear to run successfully in FLOW, but no email is sent. 

 

2022-03-11_21-43-50.gif

@bradlaw ,

Not sure what is the issue but it should work fine.

Validate your last run and check output for the actions which is not working as expected.

 

 

Regards,

Prakash

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (4,600)