However, I am facing a challenge the API endpoint retrieves data dynamically and requires a parameter called ExpNumber, for example:
POST request body:
{
"ExpNumber": "EXP-000001"
}
The issue is that ExpNumber changes for each request. For example, a user might want to retrieve information for document EXP-000013 instead of EXP-000001.
My question is:
How can I pass a dynamic value like ExpNumber from the user’s prompt to the API when using Custom Knowledge in Copilot Studio? And how can I take advantage of these system variables to achieve this?
System.SearchQuery
System.KeywordSearchQuery
System.SearchResults
I want to understand how to use these variables to build a dynamic custom knowledge source that calls my API with different ExpNumber values based on the user’s request.
Thank you for you suggestion and answers
This is the API response
{
"ExpenseReportHeader": {
"ExpNumber": "EXP-000001",
"ApprovalStatus": "In review",
"CreatingWorker": "User One",
"Location": "",
"FinalApprover": "Manager One",
"LegalEntity": "LE01",
"Purpose": "Testing Workflow AI",
"Description": "Sample AI agent test",
"IntercompanyLE": "LE01",
"InvoiceId": "",
"PostedDate": "",
"ReferenceDataAreaId": "LE01",
"SourceDocumentHeader": 0,
"ModifiedDateTime": "01/01/2026 10:00:00 AM",
"ModifiedBy": "User One",
"ModifiedTransactionId": 10001,
"CreatedDateTime": "01/01/2026 09:50:00 AM",
"CreatedBy": "User One",
"TotalExpenseReportAmount": "100,000.00 CUR",
"BudgetCode": "BC0001-Sample Budget",
"BudgetOwner": "User One",
"Department": "DEP01 , Sample Department",
"ReviewLink": "https://example.test/link",
"LastComment": "",
"PendingUsers": [],
"ApprovedBy": [
"Manager One on 01/01/2026 10:10:00 AM",
"User One on 01/01/2026 10:05:00 AM"
],
"LastApprovedBy": "Manager One on 01/01/2026 10:10:00 AM",
"SubmittedBy": "User One On: 01/01/2026 10:00:00 AM"
},
"LineTransactions": [
{
"ExpenseTransactionNumber": "00000001",
"LegalEntity": "LE01",
"ExpenseLineType": "Default",
"TransactionDate": "01/01/2026 12:00:00 AM",
"ApprovalStatus": "Approved",
"ApprovedDate": "",
"Merchant": "Sample Merchant A",
"TransactionAmount": "40,000.00 CUR",
"NetTransactionAmount": "40,000.00 CUR",
"CreatedBy": "User One",
"CreatedDateAndTime": "01/01/2026 09:55:00 AM",
"ReceiptAttached": 1,
"Description": "Sample expense A",
"PaymentMethod": "ADV SET",
"CostOwner": 0,
"ExpenseCategory": "Category A",
"AdditionalInformation": "Line info A",
"BudgetCode": "BC0001-Sample Budget",
"BudgetOwner": "User One",
"Department": "DEP01 , Sample Department",
"Voucher": "",
"LineNumber": 1.0,
"WorkFlowLineLastComment": "By: User One on 01/01/2026 10:15:00 AM: Sample comment",
"WorkFlowLinePendingUsers": [],
"WorkFlowLineApprovedBy": [
"User One on 01/01/2026 10:15:00 AM"
],
"WorkFlowLineLastApprovedBy": "User One on 01/01/2026 10:15:00 AM",
"WorkFlowLineSubmittedBy": "User One on 01/01/2026 10:15:00 AM"
},
{
"ExpenseTransactionNumber": "00000002",
"LegalEntity": "LE01",
"ExpenseLineType": "Default",
"TransactionDate": "01/01/2026 12:00:00 AM",
"ApprovalStatus": "In review",
"ApprovedDate": "",
"Merchant": "Sample Merchant B",
"TransactionAmount": "60,000.00 CUR",
"NetTransactionAmount": "60,000.00 CUR",
"CreatedBy": "User One",
"CreatedDateAndTime": "01/01/2026 09:58:00 AM",
"ReceiptAttached": 1,
"Description": "Sample expense B",
"PaymentMethod": "ADV SET",
"CostOwner": 0,
"ExpenseCategory": "Category B",
"AdditionalInformation": "Line info B",
"BudgetCode": "BC0001-Sample Budget",
"BudgetOwner": "User One",
"Department": "DEP01 , Sample Department",
"Voucher": "",
"LineNumber": 2.0,
"WorkFlowLineLastComment": "",
"WorkFlowLinePendingUsers": [
"User One"
],
"WorkFlowLineApprovedBy": [],
"WorkFlowLineLastApprovedBy": "",
"WorkFlowLineSubmittedBy": ""
}
]
}