web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Show JSON data as resp...
Copilot Studio
Answered

Show JSON data as response from Agent

(0) ShareShare
ReportReport
Posted on by 23

 Hi, 

 

I am new to Power Agent and I am having a difficult time trying to wrap my head around JSON response. I have a desktop flow which generates a custom JSON object and returns it to the Power Agent Flow. I want to display that JSON data as a response from the bot. I have created the Schema as well but I get the message saying

 

"The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach."

 

{
    "type""object",
    "properties": {
        "Table": {
            "type""array",
            "items": {
                "type""object",
                "properties": {
                    "Customer": {
                        "type""string"
                    },
                    "Name 1": {
                        "type""string"
                    },
                    "Document Type": {
                        "type""string"
                    },
                    "Billing Document": {
                        "type""string"
                    },
                    "Arrears after net due date": {
                        "type""string"
                    },
                    "Document Number": {
                        "type""string"
                    },
                    "Posting Date": {
                        "type""string"
                    },
                    "Amount in local currency": {
                        "type""string"
                    },
                    "Description": {
                        "type""string"
                    },
                    "Text": {
                        "type""string"
                    },
                    "Net due date symbol": {
                        "type""string"
                    },
                    "Payment date": {
                        "type""string"
                    },
                    "Document Date": {
                        "type""string"
                    }
                },
                "required": [
                    "Customer",
                    "Name 1",
                    "Document Type",
                    "Billing Document",
                    "Arrears after net due date",
                    "Document Number",
                    "Posting Date",
                    "Amount in local currency",
                    "Description",
                    "Text",
                    "Net due date symbol",
                    "Payment date",
                    "Document Date"
                ]
            }
        }
    }
}
 
 
This is my JSON format. I am unable to figure this out even after reading other people's queries. Your help would be really appreciated.
 
 
 
zaidalvi_0-1698323619386.pngzaidalvi_1-1698323756971.png

 

Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @zaidalvi,

     

    You can use that returned Table property and format it as a Markdown table. In that format you should be able to return it as response in the Complete output variable.

     

    Below is a blog on how you could apply that markdown formatting:

    https://powerusers.microsoft.com/t5/Power-Virtual-Agents-Community/How-to-use-mark-down-to-format-a-table-for-the-bot-response/ba-p/1190942

     

    Let us know if you need more help with configuring this or if something is unclear.

  • zaidalvi Profile Picture
    23 on at

    @Expiscornovus 

    I have been trying to implement this but I run into the issue of the bot session expiring. (Timeout)

    It takes over two minutes for the PVA to process the desktop and parse the JSON response. Your thoughts?

    Also thank you for taking out the time to respond. 

  • HenryJammes Profile Picture
    on at

    Hi @zaidalvi, the JSON you shared appears to be the schema.

    Do you have a sample of the JSON data you want to display in PVA?

    How would you like it be formatted in a message?

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @zaidalvi

     

    Can you share a screenshot of your failed flow instance, which timed out? Can you also share the unattended desktop flow configuration as well. Might be useful to see that for troubleshooting purposes. 

     

    @HenryJammes, we probably need to focus on the time-out issue first before helping out with the formatting.

  • zaidalvi Profile Picture
    23 on at

    @Expiscornovus 

    So my Power Virtual Agent flow looks likes this:

    zaidalvi_0-1698746460982.png


    The Run a flow built with Power Automate for desktop properties have been set to: 

    zaidalvi_1-1698746532303.png

     

    In the parallel branch I have set Post Message in a chat to stop PVA agent from timing out but it isnt working properly. 

     

    Where as my bot shows this: 

    zaidalvi_2-1698746618872.png

    My Desktop flow only has steps to access SAP and extract a file as excel. The entire PVA flow takes around 3 minutes to execute. 
    None of my work arounds have worked so far. What would you suggest?

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @zaidalvi,

     

    As far as I am aware the default time-out is 90 seconds. So, if your desktop flow takes three minutes, that is a bit longer than the default time-out setting.

     

    So, that might be a challenging one, since the time-out setting cannot be changed/updated.

     

    There is an idea to be able to update this time-out value:

    https://ideas.powervirtualagents.com/d365community/idea/6fcc9c42-7a4a-4e10-a9f3-f1b233d7955d

     

    Which channel is used to publish the bot? If it is on Teams you might be able to use pro-active messages as a workaround? You could potentially trigger a 'child' flow (with a HTTP action and an when a HTTP request is received trigger action) which has the desktop flow action in it and return the result as a pro-active message.

     

    This way you can let the parent flow complete within the time-out setting limits and the child flow take whatever time it needs 😁

  • zaidalvi Profile Picture
    23 on at

    @Expiscornovus I thought by sending messages through to the teams chat was pro active messaging?

    Do you possibly have an example of how I should structure the flow in way that enables this work around. 

     

    Also thank you for your initial response that did clear out the table formatting so I have accepted that as a solution. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 261 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 198 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard