Adaptive Card - Toggle.Visibility

Brass Contributor

Using Designer | Adaptive Cards, I created one with below card payload, which is injected into Teams via Power Automate. Data Source/Triggers is when a new (Microsoft) from is submitted.

For the Toggle.Visibility -- it works but it reverts to original state after leaving and re-entering the channel.  Is there a way to keep (hide or show) permanent? 

Basically, when user clicks "mark as resolved" button - it shows the "Revolved" textblock and hides the "message" block. 

 

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": "auto",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Resolved",
                            "wrap": true,
                            "color": "Attention",
                            "size": "Large",
                            "weight": "Bolder",
                            "isSubtle": false,
                            "isVisible": false,
                            "id": "lead-resolved"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Subject",
                            "wrap": true,
                            "size": "Large",
                            "fontType": "Default",
                            "weight": "Bolder"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "width": "auto",
                    "items": [
                        {
                            "type": "ActionSet",
                            "actions": [
                                {
                                    "type": "Action.ToggleVisibility",
                                    "title": "Mark as resolved",
                                    "targetElements": [
                                        "lead-resolved",
                                        "lead-resolved1",
                                        "lead-resolved2",
                                        "lead-resolved3",
                                        "lead-resolved4"
                                    ]
                                }
                            ],
                            "horizontalAlignment": "Right",
                            "id": "lead-resolved1"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "width": "auto",
                    "items": [
                        {
                            "type": "ActionSet",
                            "actions": [
                                {
                                    "type": "Action.OpenUrl",
                                    "title": "Reply",
                                    "url": "mailto:"
                                }
                            ],
                            "horizontalAlignment": "Right"
                        }
                    ],
                    "id": "lead-resolved3"
                }
            ]
        },
        {
            "type": "FactSet",
            "facts": [
                {
                    "title": "Submitted by",
                    "value": "Value 1"
                },
                {
                    "title": "Date",
                    "value": "Value 2"
                },
                {
                    "title": "Browser",
                    "value": "Value 2"
                },
                {
                    "title": "Web Page URL",
                    "value": "Value 2"
                },
                {
                    "title": "Tag",
                    "value": "Value 2"
                },
                {
                    "title": "Status",
                    "value": ""
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.ToggleVisibility",
                    "title": "View/Hide Message",
                    "targetElements": [
                        "lead-resolved2"
                    ]
                }
            ],
            "isVisible": false,
            "id": "lead-resolved4"
        },
        {
            "type": "TextBlock",
            "text": "${description}",
            "wrap": true,
            "separator": true,
            "id": "lead-resolved2"
        }
    ],
    "msteams": {
        "width": "Full"
    },
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4"
}

 

 

 

bot.png

 

4 Replies
Thanks for raising your query.
We will look into it and let you know the updates.

@Tamras1972 - We have tried to repro this issue by sending the adaptive card via power automate and observed below behaviour. After navigating away from adaptive card channel message and coming back again the card gets reset as shown in below video recording.

Do you want to keep it as it is when you return back i.e. do not reset?

@Prasad_Das-MSFT 
Thank you for looking into this.  I ended up adding a SharePoint list.  So essentially, when a response from MS Forms is received, Power Automate creates a list item and post the message in Teams.  When status changes, user must modify the list item which triggers another workflow to update the card in the channel. I'm still testing the 2nd workflow but seems to be working so far.

 

In the adaptive card, not sure, but maybe another button next to visibility check box in settings to either reset or not? Currently, the visibility resets after leaving the channel.  If the button (new) is checked, the object (i.e. textblock) will not reset after leaving the channel?!?

@Tamras1972 - Currently, it seems to be designed such as the visibility resets after leaving the channel.