Search code examples
microsoft-teamspower-automateadaptive-cards

How to create a teams card using external webservice and post data in power automate(Part 2)


This is a continuation of my other question: My first question

What I am trying to accomplish:

  1. User enters a mention
  2. My web service creates an adaptive card form with custom data (same schema)
  3. presents the card to my user
  4. user enters some data
  5. Submit sends this form data to my web service for processing

Here is the card (the result of the 1st http) I am sending in reply to mention

        $var = '{
        "type": "AdaptiveCard",
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.2",
        "msTeams": {
            "width": "full"
        },
        "body": [
            {
                "type": "TextBlock",
                "text": "Adaptive Card Example",
                "wrap": true,
                "size": "large",
                "weight": "bolder",
                "id": "title"
            },
            {
                "type": "Input.Text",
                "placeholder": "Provide your thoughts",
                "separator": true,
                "isMultiline": true,
                "id": "thoughts"
            },
            {
                "type": "ActionSet",
                "separator": true,
                "actions": [
                    {
                        "type": "Action.Submit",
                        "title": "Submit",
                        "style": "positive",
                        "id": "submit"
                    }
                ]
            }
        ]
    }
    ';

My power flow automation

How do i get to the value of input.text with the id of thoughts? everything i see, it ends up blank.

I am not sure what else you need to help, i can edit/post anything else.

*EDIT

this is my dynamic dropdown.

enter image description here


Solution

  • You should be able to make use of the dynamic content presented to you that is taken directly from your adaptive card definition ...

    Dynamic Properties

    If the dynamic property doesn't exist, the easiest way to get the result is to simply refer to it using an expression ...

    body('Post_adaptive_card_and_wait_for_a_response')?['data']?['thoughts']
    

    ... you could do the work to fully qualify the dynamic properties but in this case, it seems like overkill.

    This is the output after I completed the card in my Teams channel ...

    Result