[Authoring] $if conditional does not work on text color
See original GitHub issueProblem Description
I am unable to switch the text color with an $if conditional. The error I get is
[Parse] Invalid value “${if(priceChange >= 0, ‘good’, ‘attention’)}” for property “color”.
Card JSON
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "THIS IS A TEST ${priceChange}",
"wrap": true,
"color": "${if(priceChange >= 0, 'good', 'attention')}"
}
]
}
]
}
Data.json
{
"priceChange": 4
}
Screenshot
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
$if conditional does not work on text color - Adaptive cards
Hi, Anyone know how to solve the problem of if conditional statement in adaptive card with power automate? Having this issue, thanks.
Read more >IF Statement for Text Color
I want to have the value in C1 equal to B1 if the text in A1 is red. Is there a way to...
Read more >JavaScript if statement changing text color - html
I was not calling the function with the if statement. so what I did was called the function from the table replacing +...
Read more >Conditional Formatting Fill Color But Don't Change Font ...
Hi, I've got a combo box with 4 options that change the font color of a range of cells (to red, blue ,...
Read more >Excel - Change Text Color Within “IF” Formula
Apply conditional formatting on the cell where the text needs to change color (the one with your above formula). Create a new rule:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @g138,
The templating expressions are evaluated using our
adaptivecards-templating
package (https://www.npmjs.com/package/adaptivecards-templating). Templates are expanded using the templating package, and then the resulting card is parsed by the Adaptive Cards library.Since the template you provided works in the designer, there is a chance that PowerAutomate doesn’t use the templating library. I would reach out to them here to see if they have any information on this.
Thanks, @anna-dingler for the response, using the library solved my issue on the node side, separate from this preview mode helped to see the change on the adaptivecard.io