cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phineas
Post Prodigy
Post Prodigy

json Compose Error

I am attempting to mimic what has been reported as a working flow.

I have created a copy and am getting the following error specific to the json 'compose' action.


There is a 'compose' action in the example flow with tthe following code - 
json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['ImageColumn'Name])

Phineas_4-1669232413275.png


In my version of the flow PA is kicking back the following error when I use the above with my column name included -

Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0':
'The template language expression 'json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['CompanyLogo'])' cannot be evaluated because property 'CompanyLogo' doesn't exist, available properties are 'results'. 

Phineas_3-1669232056373.png


When I change the compose language to the following -
json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['result')

I get the following error. (when I enter "results" PA defaults it to the singular 'result' on update, which is why it reads as it does). 

Phineas_0-1669230153887.png


Compose Error:

Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language expression 'json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['result'])' cannot be evaluated because property 'result' doesn't exist, available properties are 'results'.

Compose Detail:

Phineas_2-1669230812700.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

You likely need to convert the image to base64 encoding. See example below where I have an image in my library that I use when sending an email. It will be the same process when adding to your PDF.

 

grantjenkins_0-1669362332354.png

 

Get file content gets the actual content of the image.

grantjenkins_1-1669362378902.png

 

Compose builds up the URL including the base64 part. The expression used here is:

<img src="data&colon;image/jpeg;base64,@{outputs('Get_file_content')?['body']?['$content']}" alt="My Image" />

grantjenkins_2-1669362429673.png

 

It then sends an email using the output from the Compose.

grantjenkins_3-1669362463474.png

 

The final result of the email in this instance is:

grantjenkins_4-1669362517135.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

grantjenkins
Community Champion
Community Champion

Where you've written the word outputs, you need to put the actual field name in there that contains the image URL.



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

11 REPLIES 11
Sundeep_Malik
Community Champion
Community Champion

Hey @Phineas 

 

The line is saying available properties are results, result with an s. You have just written result.

 

Write this expression:

json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results'])

 

By writing the s you won't get the error now.

I finally got it to take. Tried all morning and it kept dropping the 's'.

Now the error is -

Phineas_2-1669234699605.png


Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'json' expects its parameter to be a string or an XML. The provided value is of type 'Array'.

Send an HTTP Details -

Phineas_3-1669234876548.png

 

If the Compose is just trying to get the results, then you shouldn't have it within a json expression as it's already in JSON format. You can just use the following expression:

 

outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results']


----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Edited Reply No. 2:

Went round and round and got it back to the following.

It's cleaned up from the original, however the original problem still exists - the 'Logo' does not appear at the top of the PDF file as an image as desired.

Phineas_2-1669314415067.png


SharePoint Library:

Phineas_3-1669314452858.png


PDF Conversion:

Phineas_4-1669314543927.png

 

grantjenkins
Community Champion
Community Champion

In your Compose 2 you aren't setting up the image tag correctly. See format below:

 

//You would replace CompanyLogo.jpg with your actual logo, etc.

<img src="CompanyLogo.jpg" alt="Company Logo" width="500" height="600">


----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

I installed your recommendation exactly as you have provided.

It only made image the size called out in the code. 

The image still does not appear.

Phineas_2-1669352255160.png

 

Phineas_1-1669352227953.png

 

 

Phineas_0-1669352197215.png

 

You don't have to add the width and height - that was just an example of what an image tag is constructed.

 

You will need to add your actual Company Logo URL as you had before. At the moment you've just got the text CompanyLogo.jpg.

 

grantjenkins_1-1669352748022.png

 

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

I took this link directly from the file in the SP Library.

Phineas_0-1669356070512.png

This was the result -

Phineas_1-1669356105560.png

 

You likely need to convert the image to base64 encoding. See example below where I have an image in my library that I use when sending an email. It will be the same process when adding to your PDF.

 

grantjenkins_0-1669362332354.png

 

Get file content gets the actual content of the image.

grantjenkins_1-1669362378902.png

 

Compose builds up the URL including the base64 part. The expression used here is:

<img src="data&colon;image/jpeg;base64,@{outputs('Get_file_content')?['body']?['$content']}" alt="My Image" />

grantjenkins_2-1669362429673.png

 

It then sends an email using the output from the Compose.

grantjenkins_3-1669362463474.png

 

The final result of the email in this instance is:

grantjenkins_4-1669362517135.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Thank you for the reply.

I tried to mimic what you did. I didn't get 'Outputs' as an option and had to manually enter all the information in the 'compose' action.

Still no image in PDF.

Phineas_3-1669388605369.png

 

Phineas_2-1669388404631.png

 

grantjenkins
Community Champion
Community Champion

Where you've written the word outputs, you need to put the actual field name in there that contains the image URL.



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

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

Community Calls Conversations

Community Calls Conversations

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

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,370)