cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SaifAli
Level: Powered On

Conversion to json for attachments using "json()" not working so far

Hi Team,

 

So currently i have a scenario in which i'm pulling the incoming attachment and their contents and trying to send them over an email 

 

So in the attachments section of send an email v2 i'm passing the json as below :

 

[

 { "Name" : "{attachment name}",

   "ContentBytes" : "{base64 encoded bytes for content returned by the API}"

 }

]

 

There are following steps for my flow :

 

Step 1 : Send the http request for different urls for different attachments and receive the their data (content-type and contentbytes)

Step 2 : Creating an Array as per the format required to send over the email that means (can be understood in below image )

Step 3 : Converting the array to the string

Step 4 : Converting the string to json

Step 5 : Sending it over in the email step

 

The problem is I'm not getting any attachments at all in the output email.

 

APIFlow.PNGFlow image 1APIflow2.PNGFlow image 2APIFlow3.PNGFlow image 3output1.PNGOutput 1output 2.PNGoutput 2output3.PNGOutput of email 

 

I think the data is not perfectly getting converted into the json? Can someone help me i really need to get it over with

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Conversion to json for attachments using "json()" not working so far

 

Hi @SaifAli ,

 

You need to add double quotes outside of Name and ContentBytes, please refer to this blog and see if it helps:

https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

And it seems that you don't need to use the json() function to convert it. You can directly fill the array variable output from the Append to array variable 2 action in Attachments field, just like the configuration in the Blog.

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Conversion to json for attachments using "json()" not working so far

 

Hi @SaifAli ,

 

You need to add double quotes outside of Name and ContentBytes, please refer to this blog and see if it helps:

https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

And it seems that you don't need to use the json() function to convert it. You can directly fill the array variable output from the Append to array variable 2 action in Attachments field, just like the configuration in the Blog.

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

SaifAli
Level: Powered On

Re: Conversion to json for attachments using "json()" not working so far

@v-bacao-msft  Thanks a lot! it was really helpful along with the blog.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 407 members 5,787 guests
Please welcome our newest community members: