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 / Custom Data Source(Jso...
Copilot Studio
Unanswered

Custom Data Source(JsonData) in Generative Answers

(2) ShareShare
ReportReport
Posted on by 18

Hi all / @HenryJammes 

 

I want to create the Generative Answers based on the My custom Data Source(JsonData).

As I want to store my jsonData as Custom data in generative answers Source and then based on user input , want to search in json data and give generative answers.

 

So I tried to set the jsonData in one variable and then parse the value in Table format and then use this variable in custom data source as below,

 

jontydadhania_0-1702902596329.png

but getting below error while running,

 

Error Message: Missing or invalid assignment for variable ‘searchResult.Content’. Error Code: MissingOrInvalidRequiredProperty Conversation Id: dfd6aa0b-e7c2-4ad2-99a2-46c4ee07b31b Time (UTC): 2023-12-18T11:17:57.785Z

 

input JsonData:

[
{
"task": "create user",
"description": "This task for create user",
"dueDate": "2024-01-31"
},
{
"task": "create admin",
"description": "This task for create admin",
"dueDate": "2024-01-15"
}
]

 

Pls Help...

How can i do that?

I have the same question (0)
  • hernandezpaul Profile Picture
    7 on at

    Hi @jontydadhania ,

     

    I was facing the same problem. 

    Basically, you need to format the input as a table with a fixed schema with the attributes/columns:

     

    • ContentLocation: URL to reference your content. From my point of view not always possible, so a dummy value should work too.
    • Content: the data you want to provide

    Example: 

    Suppose your using the API output schema (from ServiceNow Knowledge Management API)

    hernandezpaul_1-1702974751095.png

    Formatting: 

    hernandezpaul_2-1702974777340.png

    For each article, an entry with Content and ContentLocation is added.

     

    I learned this from this great video: Copilot Studio Generating Answers from a Custom Index such as ServiceNow Knowledgebase (youtube.com)

     

    Hope that helps.

  • HenryJammes Profile Picture
    on at

    Thank you @hernandezpaul, that's exactly it. Custom data expects a specific format for the table: Use a custom data source for generative answers - Microsoft Copilot Studio | Microsoft Learn

  • jontydadhania Profile Picture
    18 on at

    Thank you @hernandezpaul and @HenryJammes  for your quick response.

    I tried that way, passed below Json to one variable and format the table schema with the attributes/columns:

    Json sample data: 

    {
         "claimNo": "abc908",
        "type": "car",
        "tasks":
           [
             {
                 "task": "create user",
                 "description": "This task for create user",
                 "dueDate": "2024-01-31"
            },
            {
              "task": "create admin",
              "description": "This task for create admin",
              "dueDate": "2024-01-15"
            }
        ]
     }
    jontydadhania_0-1702995947506.png

     

    But still getting below error,

     

    Error Message: Missing or invalid assignment for variable ‘searchResult.Content’. Error Code: MissingOrInvalidRequiredProperty Conversation Id: b03504f5-019d-406e-8ea8-2c750e637732 Time (UTC): 2023-12-19T13:13:47.534Z

     

    My Usecase: Based on jsonData I want to search and create generative answers on user input.

                         Example:  if user ask in copilot: what is due date for user task?

                                         then based on this json copilot will provide generative answers to user.

     

     

    Please let me know what am i missing here to get the result?

     

    Thanks for help

  • jontydadhania Profile Picture
    18 on at

    Hello @HenryJammes 

     

    My Use case: Based on the custom connectors response (Json data), will store this Json response in variable and now based on user input, I want to create generative answers from that json response. I don't want to search from any document.

     

    Please suggest, how can i solve my use case using copilot studio?

     

    Let me know if need more details.

    Thanks for Help....

     

     

     

     

  • Verified answer
    HenryJammes Profile Picture
    on at

    Hi @jontydadhania,

     

    I got it to work by using this formula:

     

    ForAll(Topic.Table,
     { 
     Content: task & " - with description " & description & " - with due date is " & dueDate,
     ContentLocation: Blank()
     }
    )

     

    HenryJammes_0-1703155287896.png

     

    Here's the full topic YAML if you would like to repro and see the steps I've taken to get there:

     

    kind: AdaptiveDialog
    beginDialog:
     kind: OnRecognizedIntent
     id: main
     intent:
     triggerQueries:
     - Custom Data Source Table
    
     actions:
     - kind: SetVariable
     id: setVariable_UkcD2G
     variable: Topic.JSON
     value: "[ { \"task\": \"create user\", \"description\": \"This task for create user\", \"dueDate\": \"2024-01-31\" }, { \"task\": \"create admin\", \"description\": \"This task for create admin\", \"dueDate\": \"2024-01-15\" } ]"
    
     - kind: ParseValue
     id: PaWmbX
     variable: Topic.Table
     valueType:
     kind: Table
     properties:
     description: String
     dueDate: String
     task: String
    
     value: =Topic.JSON
    
     - kind: SetVariable
     id: setVariable_APwrEb
     variable: Topic.CustomData
     value: |-
     =ForAll(Topic.Table,
     { 
     Content: task & " - with description " & description & " - with due date is " & dueDate,
     ContentLocation: Blank()
     }
     )
    
     - kind: SearchAndSummarizeContent
     id: searchAndSummarizeContent_NCLHgt
     userInput: what is due date for user task?
     variable: Topic.Answer
     additionalInstructions:
     publicDataSource: {}
     sharePointSearchDataSource: {}
     customDataSource:
     searchResults: =Topic.CustomData
    
     - kind: ConditionGroup
     id: conditionGroup_oacZ3K
     conditions:
     - id: conditionItem_ak7vHT
     condition: =!IsBlank(Topic.Answer)
     actions:
     - kind: EndDialog
     id: xanuPR

     

  • jontydadhania Profile Picture
    18 on at

    Thanks a lot @HenryJammes for help.
    now it's working and I have accepted the solution.

  • Gayathrikannanv Profile Picture
    2 on at

    In Copilot I am using http request and getting the values from API. And the response is in the following format:

    [
        {
            "TicketNumber": "XYZ9876543210",
            "FlightStatus": "Scheduled",
            "Departure": "Chennai",
            "DepartureTime": "2024-03-18T06:30:15.932Z",
            "Arrival": "Trichy",
            "ArrivalTime": "2024-03-18T09:30:15.951Z",
            "AirlineName": "IndiGo",
            "ClassOfService": "Economy"
        },
        {
            "TicketNumber": "ABC1234567890",
            "FlightStatus": "Scheduled",
            "Departure": "Chennai",
            "DepartureTime": "2024-03-18T07:30:42.231Z",
            "Arrival": "Trichy",
            "ArrivalTime": "2024-03-18T10:00:42.258Z",
            "AirlineName": "IndiGo",
            "ClassOfService": "Economy"
        }
    ]
    Now I have stored this response to a variable of Table type.
    Initially I was getting this error- Error Message: Missing or invalid assignment for variable ‘searchResult.Content’. 
     
    Then I tried as you've mentioned above with below formula -
    ForAll(Topic.FlightDetails,
    {
    Content: TicketNumber & " - with Status " & FlightStatus ,
    ContentLocation: Blank()
    }
    )
     
    (Note: I am using this formula in the data source of Generative answers. Correct me if that's wrong.)
     
    Here, TicketNumber and FlightStatus are the fields from the json provided above.
     
    On doing this, I am getting below error-

    Name isn't valid. 'TicketNumber' isn't recognized.

    Name isn't valid. 'FlightStatus' isn't recognized.

     

    Please help me on this!

  • Suggested answer
    CU19070401-0 Profile Picture
    32 on at
    Here is a step-by-step walk-through article for this formula validation in Copilot Custom Data Formula: https://global-sharepoint.com/copilot/generative-answers-with-http-request/
     
    Here is a YouTube video about the formula validation issue in Copilot Custom Data Formula:

    YouTube Video on Microsoft Copilot Studio Full Tutorial for Beginners, Explained Step by Step : https://youtu.be/p5SleksT7bA

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 265 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard