Skip to main content

Notifications

Announcements

No record found.

Calling Actions from Copilot Studio
Answered

Using the "Custom Data" option in "Create generative answers" in copilot studio

Posted on by

Hi! I am testing some different features of copilot studio, and I got interested in testing using the "Generative answers" action using "Custom data". 

 

victoriag_0-1705308347985.png

Looking at the documentation, it seems like it would be possible to use the output from a power automate flow, send it back to copilot studio, and create a generative answer based on this. The documentation shows that the input to the "custom data" field takes a json array of objects. 

victoriag_1-1705308752511.png

 

As an initial test I wanted to return the sample json in the screenshot above from power automate, send it to copilot studio and use this data to set the custom data field in the "Create generative answer" action. 

 

Inside power automate.

I set the example data from the screenshot above inside "compose", parse it and then return it to copilot. 

victoriag_3-1705308962695.png

I return the "body" and this is how it looks like inside power automate. I return it as a string type because it does not seem like it is any other suitable alternatives to return a json/array or table. 

victoriag_5-1705309075932.png

Below is a screenshot of the "output", I return the "body"-field. 

 

victoriag_4-1705309064289.png

 

Inside Copilot studio. 

I call the ComposeCustomData flow (ignore the input as I do not really use it for anything).

victoriag_6-1705309164861.png

First of all, if I try to run this inside copilot studio, I get the error message:

 

Error: The parameter with name customdata on the flow ComposeCustomData (bd97892b-1db1-ee11-a569-000d3adf9328) was evaluated to the type TableDataType, expected type StringDataType Error-code: FlowActionBadRequest Conversation-ID: d6fe75a7-de90-4fdb-8a74-494e303f3b71 Tid (UTC): 2024-01-12T10:02:10.696Z

 

Which makes sense I guess (?), since I try to return a json, but defined it as a string.
The reason why I'm trying to do this is because the custom data field (in the screenshot below) requires a table type. So even if I try to pass the "customData"-output from the flow, it complains that it is a string and not a table type.

 

victoriag_7-1705309320575.png

 

Am I missing something here? 😅 I am a bit confused that I cannot return any other suitable type from power automate apart from "string", and the "Custom data" field requires a "Table", but in the documentation it says that input should be a json array of objects (maybe it is the same?). Also the documentation says that the data in the "Custom data" field could be supplied from a power automate flow, so I guess it should be possible somehow. 

 

Any suggestions would be highly appreciated 😀

  • fernandoqc Profile Picture
    fernandoqc on at
    Re: Using the "Custom Data" option in "Create generative answers" in copilot studio

    Hey,

    I was able to resolve the issue by modifying the response parameter to remove the JSON content type.

     

    Originally: response.Content = new StringContent(outputString, Encoding.UTF8, "application/json");

    Updated to: response.Content = new StringContent(outputString, Encoding.UTF8);

     

    By doing this, the HTTP response was treated as a plain string instead of JSON. I then parsed it as a table before sending it to the genAI node.

  • fernandoqc Profile Picture
    fernandoqc on at
    Re: Using the "Custom Data" option in "Create generative answers" in copilot studio

    got the same error

  • kinwong Profile Picture
    kinwong on at
    Re: Using the "Custom Data" option in "Create generative answers" in copilot studio

    I got a similar Error Message: The parameter with name ‘spanswer’ on flow ‘POC - G&E Disclosures’ (‘6cc82777-3b7a-07a0-929b-16c38389d0e7’) evaluated to type ‘TableDataType’ , expected type ‘StringDataType’ Error Code: FlowActionBadRequest Conversation Id: cbae0d28-bd3b-448c-8ac3-b42eedb9012f Time (UTC): 2024-04-30T18:28:08.771Z

     

    It seems the error complained the output of the node below.  It expects a string data type but receive a table. This is true the output of the flow is a table, but there is no table output option in "Respond to Copilot" in Power Automate.

    kinwong_0-1714502044293.png

    I have a Parse value node after the Action node.  But the Parse value node didn't call because it was failed in the previous Action node.  

  • victoriag Profile Picture
    victoriag on at
    Re: Using the "Custom Data" option in "Create generative answers" in copilot studio

    Thank you!! This solved my problem 🙂

  • Verified answer
    HenryJammes Profile Picture
    HenryJammes on at
    Re: Using the "Custom Data" option in "Create generative answers" in copilot studio

    Hi @victoriag 

     

    Before you pass it to Generative Answers, you should use a "Parse value" node.

    You can use your sample JSON payload to automatically detect the schema for the format.

     

    From what you describe, you'll then be able to pass the desired custom data table as Topic.YourParsedVariable.body.customdata.

     

    Henry

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Featured topics