MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
277 stars 501 forks source link

"firstRowAsHeaders" property in adaptive card doesn't work in teams #9241

Open qjkobe opened 11 months ago

qjkobe commented 11 months ago

Let's use the same adptive card json:

{
  "type": "AdaptiveCard",
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.5",
  "body": [
    {
      "type": "Container",
      "items": [
        {
          "type": "TextBlock",
          "text": "View Cases:",
          "wrap": true,
          "size": "Large",
          "weight": "Bolder"
        }
      ]
    },
    {
      "type": "Table",
      "columns": [
        {
          "width": 1
        },
        {
          "width": 1
        }
      ],
      "rows": [

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "View Cost Center",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "View Cost Center",
                    "data": {
                      "msteams": {"type": "task/fetch"},
                      "requestType": "command",
                      "namespace": "EC",
                      "command": "ESSMSS",
                      "step": "InitTemplate",
                      "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                      "TemplateCode": "VIEW_COST_CENTER",
                      "TemplateLabel": "View Cost Center"
                    }
                  }
                }
              ]
            }
    ,
            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "View Job",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "View Job",
                    "data": {
                      "msteams": {"type": "task/fetch"},
                      "requestType": "command",
                      "namespace": "EC",
                      "command": "ESSMSS",
                      "step": "InitTemplate",
                      "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                      "TemplateCode": "VIEW_JOB",
                      "TemplateLabel": "View Job"
                    }
                  }
                }
              ]
            }

          ]
        }
,

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "View Location",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "View Location",
                    "data": {
                      "msteams": {"type": "task/fetch"},
                      "requestType": "command",
                      "namespace": "EC",
                      "command": "ESSMSS",
                      "step": "InitTemplate",
                      "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                      "TemplateCode": "VIEW_LOCATION",
                      "TemplateLabel": "View Location"
                    }
                  }
                }
              ]
            }

          ]
        }

      ],
      "firstRowAsHeaders": false,
      "showGridLines": false
    },
    {
      "type": "Container",
      "items": [
        {
          "type": "TextBlock",
          "text": "Change Cases:",
          "wrap": true,
          "size": "Large",
          "weight": "Bolder"
        }
      ]
    },
    {
      "type": "Table",
      "columns": [
        {
          "width": 1
        },
        {
          "width": 1
        }
      ],
      "rows": [

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Pronouns",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Pronouns",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "EDIT_PRONOUNS",
                    "TemplateLabel": "Change Pronouns"
                    }
                  }
                }
              ]
            }
,

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Location",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Location",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_LOCATION",
                    "TemplateLabel": "Change Location"
                    }
                  }
                }
              ]
            }

          ]
        }
,

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Chosen Name",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Chosen Name",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_CHOSEN_NAME",
                    "TemplateLabel": "Change Chosen Name"
                    }
                  }
                }
              ]
            }
,

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Pronouns",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Pronouns",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_PRONOUNS",
                    "TemplateLabel": "Change Pronouns"
                    }
                  }
                }
              ]
            }

          ]
        }
,

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Legal Name",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Legal Name",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_LEGAL_NAME",
                    "TemplateLabel": "Change Legal Name"
                    }
                  }
                }
              ]
            }
,

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Job",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Job",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_JOB",
                    "TemplateLabel": "Change Job"
                    }
                  }
                }
              ]
            }

          ]
        }
,

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Working Time",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Working Time",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_WORKING_TIME",
                    "TemplateLabel": "Change Working Time"
                    }
                  }
                }
              ]
            }
,

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Change Cost Center",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Change Cost Center",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "CHANGE_COST_CENTER",
                    "TemplateLabel": "Change Cost Center"
                    }
                  }
                }
              ]
            }

          ]
        }
,

        {
          "type": "TableRow",
          "cells": [

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Transfer",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Transfer",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "TRANSFER",
                    "TemplateLabel": "Transfer"
                    }
                  }
                }
              ]
            }
,

            {
              "type": "TableCell",
              "items": [
                {
                  "type": "Container",
                  "items": [
                    {
                      "type": "TextBlock",
                      "text": "Promotion",
                      "wrap": true,
                      "color": "Accent"
                    }
                  ],
                  "selectAction": {
                    "type": "Action.Submit",
                    "title": "Promotion",
                    "data": {
                    "msteams": {"type": "task/fetch"},
                    "requestType": "command",
                    "namespace": "EC",
                    "command": "ESSMSS",
                    "step": "InitTemplate",
                    "targetId": "7E3BA58C56CD46B3B2EA743AD7491345",
                    "TemplateCode": "PROMOTION",
                    "TemplateLabel": "Promotion"
                    }
                  }
                }
              ]
            }

          ]
        }

      ],
"firstRowAsHeaders": false,
"showGridLines": false
    }
  ]

}

In adaptive, it is renderred as: image But in Teams, it is renderred as:

image

It's obvious that the text in first row is bold. That mean the property "firstRowAsHeaders" doesn't work.

ChetanSharma-msft commented 11 months ago

Hello @qjkobe - Thanks for raising your query. We will look into it and let you know the updates.

Prasad-MSFT commented 11 months ago

We are able to repro this issue. On setting, "firstRowAsHeaders": false In MS Teams: image

In Adaptive card designer: image

We have raised a bug for the same. We will inform you once we get any further update from engineering team. Thanks!

paalolav commented 5 months ago

Any updates here? We have the same issue.

Prasad-MSFT commented 5 months ago

@paalolav - Apologies. Currently there is no ETA to share. We are following up with engineering team about this issue. We will update this thread once we hear from them. Thanks!

paalolav commented 5 months ago

@Prasad-MSFT Thank you for your reply. I'll watch this space.

ryjorgs commented 4 months ago

Our organization found this same issue while designing adaptive cards for Teams, hoping it gets resolved in the near future.

Prasad-MSFT commented 4 months ago

Hi @qjkobe , @paalolav , @ryjorgs - We got update from engineering team that, Correct name should be firstRowAsHeader(singular) not firstRowAsHeaders which specifies whether the first row of the table should be treated as a header row or not.

Schema Ref: https://adaptivecards.io/explorer/Table.html

Engineering team has decided to change the backend accordingly.

paalolav commented 4 months ago

Wow! Thank you. I’ve modified a solution which will run on monday morning. Fingers crossed!

Best regards, Pål Olav Loftesnes

On 20 Mar 2024, at 11:58, Prasad-MSFT @.***> wrote:

Hi @qjkobe https://github.com/qjkobe , @paalolav https://github.com/paalolav , @ryjorgs https://github.com/ryjorgs - We got update from engineering team that, Correct name should be firstRowAsHeader (singular) not firstRowAsHeaders which specifies whether the first row of the table should be treated as a header row or not.

Schema Ref: https://adaptivecards.io/explorer/Table.html

Engineering team has decided to change the backend accordingly.

— Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/msteams-docs/issues/9241#issuecomment-2009292045, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANFQVJ4574PP45D6MS7I5F3YZFTUZAVCNFSM6AAAAAA3TX4STOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZGI4TEMBUGU. You are receiving this because you were mentioned.

nic-iqmo commented 3 months ago

Using the singular 'firstRowAsHeader' still didn't work for me in teams. As a temporary workaround, you can add an empty row as the first row to your table and this should produce the expected result.

an-sy commented 1 month ago

the .net package AdaptiveCards version 3.1.0 has in AdaptiveTable onl< FirstRowHeaders, which is not working, the property FirstRowHeader is missing...