You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Logic App中正确使用tolower()函数处理条件判断

Fixing Case-Insensitive Conditions with tolower() in Logic Apps

First, let's break down why you're hitting that InvalidTemplate error—usually it's because the expression syntax for tolower() isn't formatted correctly in your condition. Here's how to fix it step by step:

1. Correct Syntax for tolower() in Conditions

In Logic Apps, when using functions like tolower() in a condition, you need to wrap the entire expression in @{} (or just start with @ in the expression editor) to tell the engine it’s a dynamic expression, not plain text.

Common Mistake (Likely Causing Your Error)

If you tried entering something like this without proper expression wrapping:

tolower(triggerBody()?['YourInputField']) equals 'true'

Or forgot to reference the dynamic content path correctly, that would trigger a template validation error.

Proper Implementation

Here's the right way to set up the condition:

  • In the left operand of your condition, switch from Dynamic content to the Expression tab.
  • Enter your tolower() expression, making sure to start with @ and reference your input field correctly. For example:
    @tolower(triggerBody()?['YourInputField'])
    
  • Set the operator to is equal to, then in the right operand, type the lowercase value you want to compare against (like true or false).

2. Step-by-Step Workflow Example

Let’s say your input comes from an HTTP trigger with a field named IsLegit. Here’s how to build the case-insensitive check:

  • Add a Condition action to your flow.
  • Click the left input box, select the Expression tab.
  • Paste this expression (adjust the field name to match your actual input):
    @tolower(triggerBody()?['IsLegit'])
    
  • Set the operator to is equal to.
  • In the right input box, type true (all lowercase).
  • Now, no matter if the input is TRUE, True, or true, it will match the condition.

3. Troubleshooting the InvalidTemplate Error

If you still see the error, double-check these details:

  • Ensure you didn’t omit the @ symbol at the start of the expression—it’s mandatory for all Logic App expressions.
  • Verify the input field path is correct: use the dynamic content picker to select the field first, then wrap it in tolower() to avoid typos. For example:
    @tolower(body('Get_Item')?['Status'])
    
  • Check for extra spaces or syntax typos in the expression (like missing parentheses or brackets).

This should resolve the template error and make your condition fully case-insensitive!

内容的提问来源于stack exchange,提问作者Beefcake

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:38:50