I have created a Power Automate Flow with the Microsoft Teams „For a selected message“ trigger to send a Teams message to Microsoft To-Do. For short: Works!
You can select such flows from a chat message or from a message inside the „Posts“ tab in Microsoft Teams by clicking on the three dots, „More actions“ and than you can select the flow:
The trigger than displays an Adaptive Card, in my example to ask for a list, a message and a reminder date.
When the user clicks an „Submit“, the Adaptive Card content is given back to the flow to continue processing. In my example I have an empty option list and I would be great to have the possibility to allow submit only if in the list dropdown a value is selected or in other word: if the dropdown is a required field. I went back to the flow designer and clicked on „Edit Adaptive Card“.
This displays the Adaptive Card Designer.
In this picture I selected the dropdown element and in the right pane you see the Element Properties you can use like Id, Placeholder, the choices, … . But there is no property the set this field as a required field. No I went to the Adaptive Cards Schema Explorer to view the properties of the Input.ChoiceSet (https://adaptivecards.io/explorer/Input.ChoiceSet.html). There is a property called isRequired and an other called errorMessage when the input is invalid.
That is what I need! I added this properties manually in the Card Payload Editor in the Adaptive Cards designer.
I saved the flow, seelcted a message, hit submit and wanted to get the error message, but the Adaptive Card was submitted without showing the message. OK, let´s check the Adaptive Card Json! I went to https://adaptivecards.io/designer and pasted my Json from the Microsoft Teams Flow trigger into the designer, enabled Preview mode and pressed Submit.
As expected, when the choise element has no value selected, I get a warn message. Great! But, wrong host app. OK, let´s change to Microsoft Teams and press the Submit button again.
No warning and the message about the Adaptive Card content is displayed. Not good. After a while I recognised the white message in the middle with the blue background. I know that this properties are from version 1.3 in the Target Version I have 1.2 (you can see this in the picture).
Good, back to my flow and change the version in the Card Payload Editor:
And here we have the information now! The maximum supported card version is 1.2!
So, there is an isRequired property in the Adaptive Cards definition for an Input.Choices element for version 1.3, but the Microsoft Teams „For a selected message“ trigger only supports the version 1.2!
We have to wait for an update for the Microsoft Teams Flow trigger!
Informations about Adaptive Cards:
Adaptive Cards 1.2 are GA in Microsoft Teams: https://developer.microsoft.com/en-us/graph/blogs/adaptive-cards-1-2-are-ga-in-microsoft-teams/
Adaptive Cards community call – July 2020 showing V1.3 and isRequired for Adaptive Cards: https://developer.microsoft.com/en-us/office/blogs/adaptive-cards-community-call-july-2020/
For more informations about this trigger see this links:
Power Automate Blog entry: https://flow.microsoft.com/en-us/blog/trigger-flows-from-any-message-in-microsoft-teams/