web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Condition failing - Un...
Power Automate
Suggested Answer

Condition failing - Unable to process template language expressions for action

(2) ShareShare
ReportReport
Posted on by 8
I have a long existing flow which is used for recording test quiz answers. I have added a new condition today, for a new quiz subject within the form. But when I submit tests it fails with the error message: InvalidTemplate. Unable to process template language expressions for action 'Condition_9' at line '0' and column '0': 'The template language function 'contains' expects parameters of matching types: a dictionary and a key (string), an array and a value (object), or a string and a substring. The provided types 'String' and 'Integer' are incompatible. Please see https://aka.ms/logicexpressions#contains for usage details.'.
 
All the questions are simple multiple choice and do not contain any punctuation the system may see as something different with code. I have even deleted the questions and re-added them in case one was added in error. Image 2 is the failing condition, image 3 is the successful one but both look identical to me. I have tried using compose functions but still the same error message occurs.
 
Is there something I am missing or is this a potential bug?
 
 
 
1.png
2.png
3.png

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

I have the same question (0)
  • David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at
    There seems to be an issue with the attachments getting scanned and released. You should insert the images of your flow into your post instead of attaching them. You'll also need to provide a better description of the issue. With the information you've provided so far, about the only thing I can tell you is that you are trying to compare a string to an integer in a condition. I don't know why you are doing that or what values get returned in the responses. 
     
    If you have a question that has choices of 1, 2 and 3, Microsoft forms will return those values back as strings. Therefore, you need to wrap the dynamic value in an int() expression to convert the string to an integer if you're using it condition. Thus, in a condition this could be comparing is "3" equal to 3 rather than is 3 equal to 3. Strings get returned with quotes around the value while integers do not, and this is why you get the error message that you posted.
  • Suggested answer
    sumit_artesian Profile Picture
    261 on at
     
    There seems to be an issue with your attachments. As David pointed out, try to attach your images directly to the text editor instead of adding them separately as attachments, as the forum does very strict checks on attachments, which sometimes takes hours to reflect.
     
    As for your issue, I think it is very clear what's happening based on your error message. It seems you are using an expression that has the contains() function, and the contains() function expects two parameters, i.e., a collection and an item. The collection can either be a dictionary, an array, or even a string, with the items being a key, an object/element, and a character/substring, respectively.
     
    Your error states that you used a string and an integer for the parameters of your contains() function, which is not allowed. I am assuming you are trying to find a character or a substring within a longer string. Something like: contains('Physics 101', 101), which is erroneous because the second parameter is an integer. 
     
    The solution is to wrap your second parameter in single quotes. It would then successfully search the original string for whatever you are trying to find in it. E.g., contains('Physics 101', '101')
     
    Let me know if this resolves your issue. If it doesn't, try to also attach your screenshots in the text editor so we can help you debug properly.

    Please âœ… Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item.
    If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like! 🩷
  • JC-12051323-0 Profile Picture
    8 on at
    Hello, I have added the images to the text.
  • Suggested answer
    David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at
    Based on what I see, it doesn't seem to make sense as to why you are getting this error message. However, use expressions that return true or false instead. For example, for the first condition, use this expression on the left side:
     
    contains(string(outputs('Get_response_details')?['body/YourQuestion']), 'email')
     
    On the right side, insert true from the expression builder so it shows as a pink icon. Be sure to revise the above expression to use the dynamic value from the forms response. Note that this is case-sensitive. If the form response contains Email instead of email, it will return false.
     
    Therefore, you may want to force the response to lowercase and only check for lowercase values:
     
    contains(toLower(string(body('Get_response_details')?['YourQuestion'])), 'email')
     
    I find using expressions to be more reliable in conditions.
     
     
  • JC-12051323-0 Profile Picture
    8 on at
    This has worked thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard