![]()
In this article, we will learn about how to use a custom data source for generative answers or how to create Generative Answers with Custom Data source. In my previous articles, I have shown what are generative answers and what are the various other data sources we can have inside the generative answers. In this article, I will show how to work with custom data, and that should be passed on to the generative answers node as a custom data source.
How to Use a Custom Data Source for Generative Answers?
In this section, I will explain how to use a custom data source for generative answers in Copilot Studio step by step.
Letโs understand this better, what I mean here. Below is my โCreate generative answersโ node, which I have added in my Copilot topic.

In this โCreate generative answersโ node, the data sources could be many, like a public web site, a SharePoint Online site, a SharePoint server site, a data verse, Power Automate connectors, and many more. You can find this whole list of data sources in this article:ย Overview of Knowledge Source in Copilot Studio โ Detailed Analysis
Apart from the above data sources, we do have sources with the custom data; that custom data could be the output of your Power Automate flow, the output HTTP API call, or any table-formatted business data that comes from your programming languages. So, this is the concept of a custom data source in Copilot to create generative answers.
In the above screenshot, I have shown the custom data that came from the Power Automate flow. Now I will show we can use the custom data with the static text, and then I will show how to pass the dynamic data into the create generative answers node as custom data. So, letโs get started one by one.
Use Static Data in Create Generative Answers Node
To add the โCreate Generative Answersโ node, follow the below navigation:
Click on the add new node -> Advanced -> click on the Generative Answers.

To pass the activity text as input into the create generative answers node, follow the below navigation:
Click on the right arrow from the input box, then from the system menu, click on โActivity.text.โ.
ย

To configure the custom data source, follow the below steps.
Click on the โData sourcesโ edit link. Then expand the classic data menu.

Then configure the below JSON as shown below:
[
ย {
ย Content: "This is a sample piece of text that was provided for testing purposes, to be replaced with content of your choice",
ย ContentLocation: "https://contoso.com/p1.htm",
ย Title: "Contoso Sample"
ย },
ย {
ย Content: "This is a second bit of sample text that can be replaced with content of your choice",
ย ContentLocation: "https://fabrikam.com/p2.htm"
ย },
ย {
ย Content: "This is a third bit of sample text that can be replaced with content of your choice",
ย Title: "Adventure Works Cycles Sample"
ย }
]

Then, my create generative answers node configuration will look like below:

Now, letโs test the โCreate generative answersโ node with the static custom data.
Create Generative Answers with Static Custom Data Demo
To test this Create Generative Answers with static custom data, I have just passed this text โAdventure Works Cycles Sampleโ in the chatbot, and the create generative answers node processed this text and answered it from the custom data source text.

Dynamic Custom Data in Create Generative Answers Copilot Studio
In this section, I will show how to pass dynamic data in the create generative answers node in Copilot Studio. Here I will pass the dynamic custom data output from Power Automate flow to the Copilot studio, where the Generative AI will frame an answer out of the output of the dynamic flow output.
Already I have created a flow for this; if you donโt know how to create and run flow from Copilot, I would recommend referring to this article:ย How to Create and Run a Flow from Copilot Studio Step by Step?
Here is my flow:

In this flow, I am just passing the below sample text inside the compose action.
[
{
Content: "This is a sample piece of text that was provided for testing purposes, to be replaced with content of your choice",
ContentLocation: "https://contoso.com/p1.htm",
Title: "Contoso Sample"
},
{
Content: "This is a second bit of sample text that can be replaced with content of your choice",
ContentLocation: "https://fabrikam.com/p2.htm"
},
{
Content: "This is a third bit of sample text that can be replaced with content of your choice",
Title: "Adventure Works Cycles Sample"
}
]

Then, parse the output of the compose action using the Parse JSON action.
Inside the Parse JSON action, passed the below schema, you can generate from sample JSON as well for the above JSON text.
{
ย ย "type": "array",
ย ย "items": {
ย ย ย ย "type": "object",
ย ย ย ย "properties": {
ย ย ย ย ย ย "Content": {
ย ย ย ย ย ย ย ย "type": "string"
ย ย ย ย ย ย },
ย ย ย ย ย ย "ContentLocation": {
ย ย ย ย ย ย ย ย "type": "string"
ย ย ย ย ย ย },
ย ย ย ย ย ย "Title": {
ย ย ย ย ย ย ย ย "type": "string"
ย ย ย ย ย ย }
ย ย ย ย },
ย ย ย ย "required": [
ย ย ย ย ย ย "Content"
ย ย ย ย ]
ย ย }
}
ย
For the content parameter in Parse JSON, pass the output of the compose action.

Then in the โRespond to Copilotโ action, create a text-type output variable something like โCustomProcessedDataโ and pass the โBody(โParse_JSONโ) as an output value.
Respond to Copilot in Power Flow configurationNote:
- You must save the flow and publish it before you go to Copilot Studio to configure it.
Thatโs it. We are done with the flow creation part. Now letโs move on to Copilot and learn how to call and run this flow from Coplit Studio.
How to Run a Flow from Copilot Studio?
As shown in the below navigation, select your flow:

Note:
- In Copilot Studio, the flow will be treated as an action, and it should be added to a Copilot Topic.
After adding the flow action, this will look like below:

In the above, I have stored the output of the flow in a string variable named โvarStrCustomProcessedDataโ.
Add a โParse valueโ node from the โVariable Managementโ menu.
For the Parse value, pass the output variable flow action from the previous step. And create another variable (โVarTableParsedDataโ) to store the output of the โparse valueโ node; the data type should be table.

Click on the โEdit schemaโ pencil icon.
Then, enter the below schema:
kind: Table properties: ย Content: String ย ContentLocation: String ย Title: String

Then, finally, add the Create Generative Answers node from the advanced menu, where in the โInputโ box pass the โActivity.Textโ from the โSystemโ variable section.
Click on the โEdit data sourcesโ link, go to the classic data, and there you will find a find a custom data box. There we need to pass the output of the โParse valueโ (โVarTableParsedDataโ) node, which must be in table data type format.

Thatโs it. We are done with the Copilot Generative Answers node configuration. Now letโs test this copilot.
In the test chatbot panel, I have just typed this text, โPlease give me the details of Adventure Works Cycles Sample,โ and the copilot was immediately given the answer, which came from the Power Automate flow execution as an output.

Now, letโs see the flow run history or status.
Yes, it did run now.


Video Demo: How to Use a Custom Data Source for Generative Answers?
Below is the step-by-step demo of this above article:
Summary: Create Generative Answers with Custom Data source
Thus, in this article, we have learned how to create generative answers with data sources from the Power Automate flow output in Copilot Studio.
YouTube Video on Copilot Studio Full Tutorial End to End
A Complete Showdown on Copilot Learning, a best ever complete walkthrough on Copilot:
ย
ย
About Post Author
Discover more from Global SharePoint
Subscribe to get the latest posts sent to your email.
