Azure Logic App issues: The template language expression ‘triggerBody()?[‘…’]’ cannot be evaluated.

  • Sandro Pereira
  • Jan 24, 2023
  • 3 min read

Today, while my team and I were trying to do a small Logic App proof-of-concept using a Request – When a HTTP request is received trigger – something quite simple and basic – with a simple JSON payload like:

{
	"Data":[
		{
			"LogicAppName":"",
			"ResourceGroupName":"",
			"SubscriptionID":""
		}
	]
}

We were always getting the following error when we were trying to trigger the Logic App using Postman:

InvalidTemplate. Unable to process template language expressions for action ‘For_each’ at line ‘0’ and column ‘0’: ‘The template language expression ‘triggerBody()?[‘Data’]’ cannot be evaluated because property ‘Data’ cannot be selected. Property selection is not supported on values of type ‘String’. Please see https://aka.ms/logicexpressions for usage details.’.

Logic App InvalidTemplate error

To be honest, I was getting annoyed because this is a simple thing that I have done thousands of times!

📝 One-Minute Brief

A practical troubleshooting guide for a common Azure Logic Apps error where the expression triggerBody() cannot be evaluated. The post explains why this issue occurs, the scenarios where it commonly appears, and how to correctly reference trigger outputs to avoid runtime failures in Logic Apps workflows.

Cause

Unfortunately, I cannot use the common excuse: “Sorry, it is Friday!” because today is Tuesday! But I can always say that most of the time the error resides between the chair and the keyboard! 🙂

You may pay more attention to the Logic App designer when you define a JSON Schema in your When a HTTP request is received trigger. It will warn you not to forget to include a Content-Type header set to application/json in your request!

When a HTTP request is received

If you do not provide the Content-Type header, it will assume it is plain text and will not parse the JSON, rendering only the properties. It will not be tokenized, and you will get this or similar errors.

Solution

The solution is quite simple: on the Postman request, add a Content-Type header and set it to application/json.

Content-Type

If you try again… problem is solved!

Logic App run successfully

Hope you find this useful!

My youngest son (almost 5 years old) is a big Star Wars fan, and when I’m trying to write something, and he arrives home and want to play with me, I always say to him: Let the father finish work to earn some money so we can buy more toys… now I promise him that all contributions from my blog are going to be used for buying Star Wars Legos!

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top