cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Adaptive Card Error - Choiceset cannot take in dynamic array

This was previously working but it broke suddenly.

 

The Choiceset takes in a dynamic array as the value and presents to the user.

 

Format of the array:

[{"title":"Value1","value":"value1"},{"title":"Value2","value":"value2"}]

 

Adaptive card:

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "type": "TextBlock",
            "text": "text",
            "wrap": true,
            "weight": "Bolder",
            "isSubtle": true,
            "fontType": "Default",
            "size": "Large"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "text",
                    "wrap": true
                }
            ]
        },
        {
            "type": "TextBlock",
            "text": "@{outputs('Get_@mention_token_for_a_user')?['body/atMention']} \nPlease assign SA for this opportunity",
            "wrap": true
        },
        {
            "type": "Input.ChoiceSet",
            "choices": @{variables('sa_array')},
            "placeholder": "Select from these choices",
            "id": "assignedSA"
        }
    ],
    "actions": [
        {
            "type": "Action.Submit",
            "title": "Submit",
            "id": "btnSubmit",
            "style": "destructive"
        }
    ]
}

 

Error message:

The request failed. Error code: 'InvalidJsonInBotAdaptiveCard'. Error Message: 'Microsoft.Azure.ProcessSimple.Data.Entities.Exceptions.ProcessSimpleDataException: The specified Teams flowbot adaptive card request is missing or invalid. The tracking Id is '{0}'. ---> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: P. Path 'body[1].items[0].text', line 20, position 72.
   at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments)
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at Microsoft.Azure.ProcessSimple.Data.Components.AdaptiveCards.AdaptiveCardBuilder.DeserializeAdaptiveCard(String serializedAdaptiveCard, RequestIdentity requestor, CultureInfo cultureInfo, BotAdaptiveCardAtMentions atMentions) in X:\bt\1136156\repo\src\processsimple\Roles\ProcessSimple.Data\Components\AdaptiveCards\AdaptiveCardBuilder.cs:line 503
   --- End of inner exception stack trace ---
   at Microsoft.Azure.ProcessSimple.Data.Components.AdaptiveCards.AdaptiveCardBuilder.DeserializeAdaptiveCard(String serializedAdaptiveCard, RequestIdentity requestor, CultureInfo cultureInfo, BotAdaptiveCardAtMentions atMentions) in X:\bt\1136156\repo\src\processsimple\Roles\ProcessSimple.Data\Components\AdaptiveCards\AdaptiveCardBuilder.cs:line 522
   at Microsoft.Azure.ProcessSimple.Web.Common.Validation.BotAdaptiveCard(String card, RequestIdentity senderRequestIdentity) in X:\bt\1136156\repo\src\processsimple\Roles\ProcessSimple.Web\Common\Validation\BotValidation.cs:line 642'.

 

This issue is resolved when I hardcore the values instead. This is not what I want.

1 ACCEPTED SOLUTION

Accepted Solutions
Regular Visitor

Hi Sik

 

Thanks for your response. I have since figured that the issue was with another field where the form result was returning a string with " in an array format string which was causing the entire JSON to break and giving wrong error information. This has since been resolved. Thanks!

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi @leroylim ,

 

Could you please share the flow steps? How do you define the array?

I made a test on my side, but can't reproduce your issue, the Array variable can be taken in the adaptive card properly, please see my test outcome.

Snipaste_2020-11-18_17-19-51.pngSnipaste_2020-11-18_17-20-02.pngSnipaste_2020-11-18_17-20-43.png

 

The clue I found from this blog is that If you’d like to use some of the features from versions 1.1 and 1.2 please turn your Teams (desktop or web) into “Developer Preview”: https://docs.microsoft.com/en-us/microsoftteams/platform/resources/dev-preview/developer-preview-int... 

Please try to enable the 'Developer Preview' mode or modify the Adaptive Card Version from 1.2 to 1.0.

 

Hope this helps.

Sik 

Regular Visitor

Hi Sik

 

Thanks for your response. I have since figured that the issue was with another field where the form result was returning a string with " in an array format string which was causing the entire JSON to break and giving wrong error information. This has since been resolved. Thanks!

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (46,145)