0

I am trying below snippet to set image as per if else condition but its now working as expected it always empty Image is one of my column name which am using in adaptive card

"items": [       
    {
        "type": "Image",
        "url": "${if({Image} == Test, 'https://test.sharepoint.com/mysite/mylib/Test.png', if({Image} == Test1, 'https://test.sharepoint.com/mysite/mylib/Test1.png')}",
        "size": "Medium",
        "horizontalAlignment": "Center",
        "altText": "Result logo"                                            
    }                                        
]
2
  • Where are you using this code? In SPFx ACE or Power Automate or anywhere else? Commented Nov 21, 2022 at 13:28
  • i am using search layout designer to design adaptive card
    – kumar
    Commented Nov 21, 2022 at 13:29

1 Answer 1

0

I was able to do it using when condition so below is the syntax

{
"type": "Image",
"url": " https://test.sharepoint.com/mysite/mylib/Test.png",
"size": "Small",
"horizontalAlignment": "Center",
"altText": "Result logo",
"$when": "${Image== 'Test'}"
},
{
"type": "Image",
"url": " https://test.sharepoint.com/mysite/mylib/Test1.png",
"size": "Small",
"horizontalAlignment": "Center",
"altText": "Result logo",
"$when": "${Image== 'Test1'}"
},
{
"type": "Image",
"url": " https://test.sharepoint.com/mysite/mylib/Test2.png",
"size": "Small",
"horizontalAlignment": "Center",
"altText": "Result logo",
 "$when": "${Image== 'Test2'}"
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.