1

I have a Chatbot developed in Microsoft Bot framework which uses an Adaptive Card (v1.2) to get inputs from the Users.

enter image description here

I fill the form details and then I click the Submit button. I am able to extract the values successfully but the adaptive card gets reset to the default values (becomes empty form).

This strange behavior happens only in MS Teams.

Any solution to maintain the updated form with the user inputs or this is the expected behavior?

pdeeepa
  • 49
  • 4
  • I tested this Adaptive cards dll 1.2.4 it works – Trinetra-MSFT Oct 23 '20 at 09:48
  • Ok, I'll try 1.2.4 – pdeeepa Oct 23 '20 at 13:46
  • There are two things about this exchange that are confusing to me. You say in your question that "This strange behavior happens only in latest versions of MS Teams. Earlier it used to work." Then Trinetra says "I tested this Adaptive cards dll 1.2.4 it works." If "working" means Adaptive Cards don't reset on submit in Teams, then both of those statements are false. Adaptive Cards have always had reset-on-submit behavior in Teams. Preserving input values didn't "work" before and it doesn't "work" now. I'm very curious to see these conditions under which Teams Adaptive Card inputs didn't reset. – Kyle Delaney Oct 23 '20 at 20:19
  • Does this answer your question? [Adaptive Card clears input on submit](https://stackoverflow.com/questions/57870044/adaptive-card-clears-input-on-submit) – Kyle Delaney Oct 23 '20 at 20:28
  • 1
    I'm also very sure I've seen this behaving as Kyle says - it always 'resets' the 'form' to empty – Hilton Giesenow Oct 25 '20 at 10:53
  • @KyleDelaney Yeah, very true. This issue seems to be present in the previous versions of MS Teams also. It was my fault. I will look into the other link you have shared. Thanks for the timely input. – pdeeepa Oct 27 '20 at 04:58
  • @KyleDelaney, when we put some value in Adaptive card form and we throw new card on submit , the data in Adaptive card input form is preserved that works with Adaptive card 1.2.4 dll. Latest Adaptive card dll is having this issue, I have raised a issue on this – Trinetra-MSFT Oct 27 '20 at 05:27
  • @Trinetra-MSFT as such i dont have the MS Bot framework source code. Will be handy if you can share me the link to dll. – pdeeepa Oct 27 '20 at 10:12
  • @Trinetra-MSFT - This has nothing to do with any Adaptive Cards dll. This is Teams-specific behavior. It only happens in Teams and it has always happened in Teams. Every other Teams team member I've spoken to has not only confirmed that the behavior exists, but also confirmed that it's by design. Bill Bliss has explained that they decided to make Adaptive Cards do this so the behavior would be more intuitive for shared Adaptive Cards in channels that multiple people can submit. It is bizarre to me that you say you hadn't experienced the behavior, but perhaps there's a misunderstanding. – Kyle Delaney Nov 26 '20 at 17:57
  • 1
    @KyleDelaney, I agree, i was passing data object to show the input fields once it got submitted, That's why i was able to see the adaptive card (maintaining the submitted data). – Trinetra-MSFT Nov 27 '20 at 04:35

1 Answers1

3

In order to preserve Adaptive Card input values in Teams, you need to do the following:

  1. Insert a unique identifier into the submit action's data object
  2. Save the activity in bot state so that it may be retrieved using the identifier
  3. When you get an incoming activity with the identifier and the input values, modify the Adaptive Card in the saved activity so that it contains the new input values and then update the activity in Teams with the modified Adaptive Card

Preserving Adaptive Card input values is one of the main features of my upcoming cards library. You can express your support on that GitHub page if you're interested.

Kyle Delaney
  • 11,616
  • 6
  • 39
  • 66
  • I'm not sure what's happened, but I'm running the new Teams client 1.3.00.24755 and I've noticed that the adaptive cards are preserving values now. Presuming something has changed on the Teams end? – Steve Johnson Nov 26 '20 at 16:51
  • 2
    @SteveJohnson - You're right, Teams has finally changed the behavior. All those hours I spent on that feature of the cards library were wasted. Oh well. – Kyle Delaney Nov 26 '20 at 18:09