仅在设置另一个输入元素时显示一个元素 - 自适应卡片
Only show an element when another input element is set - Adaptive Cards
我目前正在学习自适应卡片,以便在 Power Automate 中使用它来将它们发送给 Microsoft 团队。
作为练习,我需要制作这张卡片:Candidate FeedBack form
我在 Microsoft Adaptive card designer 中构建了卡片,并获得了这张卡片的有效负载:
{
"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 "决定”等同于“雇用”。所以这就是问题所在,我怎样才能实现仅在 id“Decision”等于“Hire”时才显示 ChoiceSet。
PS:我看到的另一件事是我可以取消将 ChoiceSet 标记为“初始可见”,并且有一个操作“ToggleVisibility”可以使其可见,但我不知道如何仅在选择雇用决策时触发该操作。
提前致谢!
您不能直接从 UI 本身执行此操作。您可以在用户提交卡片时更新卡片,但是现在没有这样的操作可以在复选框选中和取消选中时执行某些事件。
我目前正在学习自适应卡片,以便在 Power Automate 中使用它来将它们发送给 Microsoft 团队。
作为练习,我需要制作这张卡片:Candidate FeedBack form
我在 Microsoft Adaptive card designer 中构建了卡片,并获得了这张卡片的有效负载:
{
"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 "决定”等同于“雇用”。所以这就是问题所在,我怎样才能实现仅在 id“Decision”等于“Hire”时才显示 ChoiceSet。
PS:我看到的另一件事是我可以取消将 ChoiceSet 标记为“初始可见”,并且有一个操作“ToggleVisibility”可以使其可见,但我不知道如何仅在选择雇用决策时触发该操作。
提前致谢!
您不能直接从 UI 本身执行此操作。您可以在用户提交卡片时更新卡片,但是现在没有这样的操作可以在复选框选中和取消选中时执行某些事件。