仅在设置另一个输入元素时显示一个元素 - 自适应卡片

问题描述 投票:0回答:2

我目前正在学习自适应卡,以便在 Power Automate 中使用它来将其发送给 Microsoft 团队。

作为练习,我需要制作这张卡片:Candidate FeedBack form

我在 Microsoft 自适应卡设计器中构建了该卡,并获得了此卡有效负载:

{
"type": "AdaptiveCard",
"body": [
    {
        "type": "TextBlock",
        "size": "Medium",
        "weight": "Bolder",
        "text": "CANDIDATE FEEDBACK FORM"
    },
    {
        "type": "ColumnSet",
        "columns": [
            {
                "type": "Column",
                "width": "auto",
                "items": [
                    {
                        "type": "Image",
                        "url": "{CandidateUrl}",
                        "altText": "ProfilePicture",
                        "horizontalAlignment": "Left",
                        "style": "Person"
                    }
                ],
                "horizontalAlignment": "Center",
                "verticalContentAlignment": "Center"
            },
            {
                "type": "Column",
                "width": "auto",
                "horizontalAlignment": "Center",
                "verticalContentAlignment": "Center",
                "style": "emphasis",
                "items": [
                    {
                        "type": "TextBlock",
                        "text": "{Candidate Name}",
                        "wrap": true,
                        "color": "Dark"
                    }
                ]
            }
        ]
    },
    {
        "type": "Container",
        "backgroundImage": {
            "url": "https://www.solidbackgrounds.com/images/950x350/950x350-light-gray-solid-color-background.jpg"
        },
        "items": [
            {
                "type": "Input.Text",
                "placeholder": "Input candidate comments",
                "id": "CandidateComments",
                "isMultiline": true,
                "isRequired": true,
                "label": "Comments",
                "errorMessage": "You must set the candidate comments"
            },
            {
                "type": "Input.ChoiceSet",
                "choices": [
                    {
                        "title": "Hire",
                        "value": "Hire"
                    },
                    {
                        "title": "No Hire",
                        "value": "No Hire"
                    }
                ],
                "placeholder": "Placeholder text",
                "isRequired": true,
                "style": "expanded",
                "id": "Decision",
                "label": "Decision",
                "errorMessage": "You must select the decision"
            },
            {
                "type": "Input.ChoiceSet",
                "choices": [
                    {
                        "title": "Past experience in the topic area",
                        "value": "Experience"
                    },
                    {
                        "title": "Inclusive behaviors and work ethics",
                        "value": "Inclusivity"
                    },
                    {
                        "title": "Ability to work without supervision",
                        "value": "Independent"
                    }
                ],
                "placeholder": "Placeholder text",
                "isMultiSelect": true,
                "style": "expanded",
                "label": "Suggest follow-up discussion regarding:",
                "id": "Suggestion"
            }
        ]
    }
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions": [
    {
        "type": "Action.Submit",
        "title": "Submit"
    }
]
}

该卡工作正常,但我有一个想法,但无法做到。问题是,我希望仅当用户选择“雇用”决定时才会出现“建议选择”元素,因为与您决定不雇用的人进行后续讨论没有多大意义。

我注意到 ChoiceSet 有一个名为“仅在何时显示”的属性,但我只能使用示例数据编辑器使其工作。例如,当我将此数据添加到示例数据编辑器时:

{
    "Test":"Testing"
}

“仅在何时显示”中的这个表达式:${$root.Test ==“Testing”},它有效,但我不需要它来处理样本数据,但当 id“Decision”等于“聘请”。这就是问题,如何才能实现 ChoiceSet 仅在 id“Decision”等于“Hire”时才显示。

PS:我看到的另一件事是,我可以将 ChoiceSet 取消标记为“初始可见”,并且有一个操作“ToggleVisibility”可以使其可见,但我不知道如何仅在雇用决定时触发该操作已选择。

提前谢谢您!

microsoft-teams power-automate adaptive-cards rpa
2个回答
0
投票

您无法直接从 UI 本身执行此操作。您可以在用户提交卡片时更新卡片,但目前没有可用的操作可以在复选框选中和取消选中时执行某些事件。


0
投票

你能实现吗?你能分享一下吗,因为我正在尝试完全相同的逻辑?

© www.soinside.com 2019 - 2024. All rights reserved.