Moblize IT
Moblize IT

Reputation: 1328

MS teams adaptive card not sending input text value on submit

I am 500% sure it used to work and all of a sudden this is broken. The card for getting input is no longer passing the value back to nodejs.

The card looks like below:

{
       "type": "AdaptiveCard",
       "body": [
           {
               "type": "TextBlock",
               "text": "Note text"
           },
           {
               "type": "Input.Text",
               "placeholder": "Type a note",
               "isMultiline":  true,
               "id": "noteIdVal"
           }
           
       ],
       "actions": [
           {
               "type": "Action.Submit",
               "title": "Save",
               "data": { "action" : "add_note", "objNumber": objId, "objType": objectType }
           },
           {
               "type": "Action.Submit",
               "title": "Cancel",
               "data" : {"action": "cancel"}
           }
       ],
       "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
   }

On the submit action, in my nodejs i am getting the data in the values node which are passed in the data field. However, it is no longer attaching noteIdVal. Did something changed from MS side?

Upvotes: 2

Views: 1246

Answers (2)

Rajeesh Menoth
Rajeesh Menoth

Reputation: 1750

MS Teams Adaptive card required special property with the name msteams to the object in an object submit action’s data property in order to access this functionality.

{
"type": "Action.Submit",
"title": "Click me for messageBack",
"data": {
"msteams": {
    "type": "messageBack",
    "displayText": "I clicked this button",
    "text": "text to bots",
    "value": "{\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"}"
},
"extraData": {}
}
}

The type property is "messageBack" the submit action will behave like a messageBack card action, which is like a combination of imBack and postBack.

Reference : Microsoft Docs for MS Teams Adaptive Card

Upvotes: 1

Moblize IT
Moblize IT

Reputation: 1328

So, may be useful to other folks here. I have two showCards and the content of both the show cards has a common text field with same id name "noteIdVal". As ultimately it is a single json and hence was the culprit.

Lesson, have all fields unique id values which is easy to miss when you have multiple show cards

Upvotes: 0

Related Questions