Using Dataverse SearchQuery in Canvas Apps

Table of Content
If you want relevance-based search across multiple Dataverse tables from a Canvas App, you can call the Dataverse unbound action directly through the Environment object:
In Canvas Apps, many makers start with the Power Fx Search() function. It works well for simple single-table filtering, but it is not the same as Dataverse Search.
Environment.SearchQuery(...)
Why use Environment.SearchQuery?
- one search box across multiple Dataverse tables
- relevance-ranked results instead of simple text matching
- support for filters, facets, ordering, paging, and richer search behavior
Before you use it
Dataverse Search must be enabled for the environment. Microsoft says it is on by default for new production environments, while other environment types may require admin enablement. Searchable tables and fields also need to be configured in Dataverse Search settings and Quick Find configuration.
Here is an Example:
// Page configuration
Set(varPageSize, 10);
Set(varPageNumber, 1);
// Search Dataverse using SearchQuery
Set(
varSearchResponse,
Environment.SearchQuery(
{
search: txtSearch.Text,
// Search only selected tables
entities:
"[{""name"":""account""},
{""name"":""contact""},
{""name"":""incident""},
{""name"":""opportunity""}]",
// Filter results
filter: "modifiedon ge 2024-01-01T00:00:00Z",
// Sort results
orderby: "modifiedon desc",
// Paging
top: varPageSize,
skip: (varPageNumber - 1) * varPageSize
}
)
);
ClearCollect(
colSearchResults,
Table(varSearchResponse.value)
)
Keep in Mind
1. Environment configuration matters
If Dataverse Search is not enabled, or the tables are not included in search, your action will not return the expected results. Microsoft states that admins must configure the environment and choose searchable tables and fields.
2. Indexed data may lag slightly
Search results are index-based, so newly created records may not appear immediately. Microsoft notes this behavior for Dataverse search-based retrieval.
3. Response shaping in Canvas Apps takes some care
Because action responses can involve dynamic objects, the main challenge is often not the search itself but shaping the result into a gallery-friendly collection. Microsoft’s guidance on direct action invocation and dynamic values is relevant here.
Summary
If your requirement is just “search Accounts in a gallery” use the normal Power Fx Search() or Filter().
But if your requirement is:
- search across Accounts, Contacts, Cases, and more
- sort by relevance
- use Dataverse’s real search engine
then the right Canvas App pattern.
Author

Mahmoud Samir
I am Mahmoud Samir, a CRM and Power Platform Technical Consultant, Developer, and Solution Architect based in Frankfurt. I help organizations design, build, and optimize Dynamics 365 and Power Platform solutions that support digital transformation and deliver real business value.