
Announcements
Hello Everyone, I have a PA flow, that displays information to the users and collects their responses via an adaptive card ( deals with failures when it comes to executing certain SQL Procedures )
The flow was functioning well during our initial testing, but now all of a sudden we are faced with this error and seem to be stuck would appreciate everyone's help in the community to get this figured out, Thank you 🙂
ERROR :
BadRequest. 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: S. Path 'body[2].text', line 30, position 15
Adaptive card syntax :
{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.2", "width": "Full", "msteams": { "width": "full" }, "body": [ { "type": "TextBlock", "text": "@{items('Apply_to_each')?['BATCH_NAME']}", "id": "Title", "spacing": "Medium", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent" }, { "type": "TextBlock", "text": "JOB: @{items('Apply_to_each')?['JOBNUM']} \n ", "id": "acHeaderTagLine", "separator": true }, { "type": "TextBlock", "text": " @{items('Apply_to_each')?['OUTPUT']}\n ", "weight": "Bolder", "size": "ExtraLarge", "spacing": "None", "id": "acHeader" }, { "type": "TextBlock", "text": "Removed.", "id": "acInstructions", "wrap": true }, { "type": "TextBlock", "text": "Error resolution options", "id": "acPollQuestion" }, { "type": "Input.ChoiceSet", "placeholder": "Select from these choices", "choices": [ { "title": "RERUN_BATCH" , "value": "RERUN_BATCH" }, { "title": "TERMINATE_BATCH" , "value": "TERMINATE_BATCH" }, { "title": "DELETE_BATCH" , "value": "DELETE_BATCH" }, { "title": "RERUN_JOB" , "value": "RERUN_JOB" }, { "title": "CHANGE_RETURN_CODE_TO_0" , "value": "CHANGE_RETURN_CODE_TO_0" } ], "id": "acPollChoices" , "style": "expanded" } ], "actions": [ { "type": "Action.Submit", "title": "Submit", "id": "btnSubmit" } ] }
will attach a screenshot for more context , would appreciate the community guidance on this one ,
Sincerely,
Pranav Sankaran
Hi Pranav,
The reason of the failure might be double quotes (") in the data from the database output. I would suggest adding compose action that will be used for storing the message json:
{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.2", "width": "Full", "msteams": { "width": "full" }, "body": [ { "type": "TextBlock", "text": "@{items('Apply_to_each')?['BATCH_NAME']}", "id": "Title", "spacing": "Medium", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent" }, { "type": "TextBlock", "text": "JOB: @{items('Apply_to_each')?['JOBNUM']} \n ", "id": "acHeaderTagLine", "separator": true }, { "type": "TextBlock", "text": " @{items('Apply_to_each')?['OUTPUT']}\n ", "weight": "Bolder", "size": "ExtraLarge", "spacing": "None", "id": "acHeader" }, { "type": "TextBlock", "text": "Removed.", "id": "acInstructions", "wrap": true }, { "type": "TextBlock", "text": "Error resolution options", "id": "acPollQuestion" }, { "type": "Input.ChoiceSet", "placeholder": "Select from these choices", "choices": [ { "title": "RERUN_BATCH" , "value": "RERUN_BATCH" }, { "title": "TERMINATE_BATCH" , "value": "TERMINATE_BATCH" }, { "title": "DELETE_BATCH" , "value": "DELETE_BATCH" }, { "title": "RERUN_JOB" , "value": "RERUN_JOB" }, { "title": "CHANGE_RETURN_CODE_TO_0" , "value": "CHANGE_RETURN_CODE_TO_0" } ], "id": "acPollChoices" , "style": "expanded" } ], "actions": [ { "type": "Action.Submit", "title": "Submit", "id": "btnSubmit" } ] }
just copy & paste the above lines in the compose action.
Next, pass the output of compose action in the post message action:
Pls save & retest the flow.
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.