OfficeDev / Microsoft-Teams-Samples

Welcome to the Microsoft Teams samples repository. Here you will find task-focused samples in C#, JavaScript and TypeScript to help you get started with the Microsoft Teams App!
MIT License
990 stars 768 forks source link

Default value provided not working in type ahead search card when used in messaging extension #455

Open shubham-betterworks opened 2 years ago

shubham-betterworks commented 2 years ago

Steps to reproduce:

  1. Clone https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-type-ahead-search-adaptive-cards/nodejs.
  2. Add messaging extension command in manifest.json
    "composeExtensions": [
    {
        "botId": "{{Microsoft-App-Id}}",
        "commands": [
            {
                "id": "dynamicsearch",
                "type": "action",
                "title": "Dynamic Search",
                "description": "Dynamic Search",
                "initialRun": false,
                "fetchTask": true,
                "context": [
                    "compose"
                ]
            }
        ]
    }
    ],
  3. Add the following messaging extension invoke handler in TeamsBot

    handleTeamsMessagingExtensionFetchTask(context, action) {
    const card = CardFactory.adaptiveCard(this.adaptiveCardForDyanamicSearch());
    
    return {
      task: {
        type: "continue",
        value: {
          card,
        },
      },
    };
    }
  4. In onInvokeActivity method change last line return null with return super.onInvokeActivity(context);
  5. Add "value": "static_option_1", in Input.ChoiceSet component of adaptiveCardForDyanamicSearch
  6. Start up the bot service

Actual Behaviour

When you open the messaging extension task module the input component renders Static Option 1 as a placeholder

Screenshot 2022-08-30 at 12 51 09 PM

Expected behaviour

When you open the messaging extension task module the input component should have Static Option 1 as the default value.

This above default value works fine when you send this same adaptive card in chat instead of task module and input component is rendered with the value Static Option 1

Screenshot 2022-08-30 at 12 51 18 PM
Meghana-MSFT commented 2 years ago

We are looking into this issue, we will get back to you.

Meghana-MSFT commented 2 years ago

We tried this at our end, and we see the following behavior -

Adaptive card in chat - Works fine image

Messaging extension - It says 1 item selected but when expanded the item is not selected image

Could you confirm if you are seeing it as 1 item selected or a placeholder value within messaging extension.

shubham-betterworks commented 2 years ago

Yes in case we set isMultiSelect to true we get a placeholder stating 1 item(s) selected but the value is not selected and checkbox is untick

Meghana-MSFT commented 2 years ago

Thank you for the confirmation, we will check internally and get back to you.

shubham-betterworks commented 2 years ago

@Meghana-MSFT any updates?

Meghana-MSFT commented 2 years ago

@shubham-betterworks - Apologies for the delay in response, A bug has been raised for the same. We will keep you posted on the updates.

Meghana-MSFT commented 2 years ago

Could you please share the below details as the engineering teams needs this information -

How did the customer initiate the ME flow? From engineering team's investigation, as long as the bot is added to a team or chat, and initiated the expected way, the ME works.

shubham-betterworks commented 2 years ago

Add the bot --> Go to the chat window with the bot --> Initiate the messaging extension command --> Search and select multiple options

ME pop-up opens but the issue here is that the default value provided is treated as a placeholder and not prefilled value for input

ChetanSharma-msft commented 2 years ago

Hello @shubham-betterworks - Sorry for delay in response. It would be better if you can share a short video for your issue.

shubham-betterworks commented 1 year ago

@ChetanSharma-msft will share it ASAP

Meghana-MSFT commented 1 year ago

@shubham-betterworks - For the issue with default choices not being showed, engineering team is investigating. We will keep you posted.

shubham-betterworks commented 1 year ago

@ChetanSharma-msft @Meghana-MSFT When a default value is provided in the input.choiceset field with dynamic search functionality enabled in the adaptive card the messaging extension treats it as a placeholder and not an actual input value whereas the same card works fine when sent as a message from a bot in the chat

https://user-images.githubusercontent.com/80667102/196605214-394ca96a-abeb-4c69-bcad-d332e90d7716.mov

Meghana-MSFT commented 1 year ago

Thank you for the video, we have shared the videos with engineering team. we will get back to you.

shubham-betterworks commented 1 year ago

@Meghana-MSFT any updates ???

ChetanSharma-msft commented 1 year ago

Hello @shubham-betterworks - We are checking the updates with engineering team and get back to you once we get any updates or confirmation.

Meghana-MSFT commented 1 year ago

Update : Engineering team has confirmed that they are actively working on the issue mentioned. We currently do not have an ETA to share.