Advanced Find and FetchXML unlock the full query power of Dataverse — but most users only use a fraction of their capability. This deep-dive lesson teaches you to build multi-table joins, write outer-join anti-join patterns the UI can't generate, save and promote personal views, and export reliable data sets for operational reporting.

Your ops manager drops a request on your desk at 4pm: she needs a list of all active service cases opened in the last 30 days where the account has a revenue tier of "Enterprise," the case owner is in the EMEA region, and no resolution has been recorded. She wants it exported to Excel by end of day. Your model-driven app has all of this data — spread across four Dataverse tables — but no published view comes close to answering that question.
This is exactly the problem Advanced Find and FetchXML exist to solve. Advanced Find is the query builder baked into every model-driven app that lets any sufficiently skilled user construct, save, and export complex multi-table queries without writing a single line of code. FetchXML is the XML-based query language Dataverse uses under the hood — and once you understand it, you can build queries that go far beyond what the UI surfaces, then reintroduce them into the platform as saved views, Web API calls, or report data sources.
By the end of this lesson, you'll be able to build multi-table queries across related Dataverse tables using both the Advanced Find UI and raw FetchXML, save those queries as personal views you can reuse and share, export filtered record sets to Excel for operational reporting, and understand the architectural limitations that govern what's actually possible at query time. You'll also learn where the UI breaks down and how FetchXML fills the gap.
What you'll learn:
You should have solid working experience with model-driven apps and Dataverse before diving into this material. Specifically, you should be comfortable with:
If you're new to model-driven views altogether, work through Building Your First Model-Driven App before continuing.
Before you open the UI, it pays to understand what Advanced Find actually is at an architectural level. Advanced Find is a query builder whose output is FetchXML — a proprietary XML dialect that the Dataverse query engine interprets and translates into SQL against the underlying managed database.
Every time you configure a filter or add a related table in Advanced Find, the UI is constructing a FetchXML document. When you click "Results," Dataverse sends that FetchXML to the query engine, which executes it and streams back a page of records. The Advanced Find UI doesn't have a direct SQL mode; it only speaks FetchXML. This means two things:
Key insight
Advanced Find generates valid FetchXML as its output, but Advanced Find cannot consume arbitrary FetchXML as its input without constraints. If you upload FetchXML that uses features the UI doesn't understand — like aggregate attributes — it will either refuse the upload or silently strip those elements. The safe workflow is: build as much as you can in the UI, download, edit the XML for the advanced parts, then save as a view through the XML route rather than re-uploading into the UI builder.
In the classic Unified Interface, Advanced Find appears via the funnel icon (labeled "Advanced Find") in the top navigation bar of a model-driven app. As of late 2023, Microsoft has been progressively rolling out "modern advanced find," which surfaces as the filter panel on the right side of a view grid with a "Edit filters" link. The underlying FetchXML behavior is identical, but the UI layout differs.
This lesson focuses on the classic Advanced Find dialog because it exposes the full FetchXML workflow, including the download/upload mechanism. The modern panel handles simple cases elegantly but doesn't yet expose the XML download for editing.
Open Advanced Find by clicking the funnel icon in your model-driven app's top navigation. The first decision you make is the primary table — the entity whose records will appear in your results. Everything else in the query is relative to this starting point.
For our ops manager scenario, start with Cases (the incident table). Your query will ultimately filter on fields from four tables: Cases, Accounts, Users (case owners), and Resolutions (the incidentresolution table). Advanced Find exposes related tables through the "Related" dropdown in both the filter and column sections.
In the filter section, click "Select" to pick a column. The dropdown shows direct columns on the Cases table first. Scroll down and you'll see a section labeled "Related Entities" — this is where multi-table queries begin.
To filter on account revenue tier, select Account (Account) → Revenue Tier (assuming you've added a custom choice column to the Account table). This tells Advanced Find to follow the lookup from Case to Account and apply a filter on the account record.
Warning
Advanced Find automatically uses an inner join when you filter on a related table column. This means that if a case has no associated account — a null lookup — that case will be excluded from results entirely, even if it would otherwise match all other criteria. For the ops scenario this is probably fine (enterprise cases should always have accounts), but be conscious of this behavior when writing queries where null relationships are meaningful.
The filter row you've just added produces a link-entity element in FetchXML with link-type="inner". We'll see this in full XML below.
Back in the filter section, add a row for Created On → Is in the last → 30 → Days. Advanced Find supports relative date operators ("last X days," "this month," "next fiscal year") which are incredibly useful for operational reporting because the query ages correctly without manual updates. The FetchXML equivalent uses the last-x-days condition operator.
The case owner relationship is a lookup to the systemuser table. To filter on the owner's region, select Owning User (User) → Territory or whatever field stores regional assignment in your data model. Again, this will produce an inner join link-entity in FetchXML.
This is where the UI starts to strain. You want cases without a resolution record — meaning you want an outer join to the incidentresolution table where the joined record is null. This is a classic "anti-join" pattern.
In Advanced Find, you can approximate this by adding a related entity filter on Case Resolutions → Resolution Type → Does Not Contain Data. This works in some versions, but the behavior is unreliable because the UI may still generate an inner join rather than a left outer join, which would simply return no rows when there's no resolution rather than returning the case.
This is the moment to reach for FetchXML directly.
Build as much of the query as the UI allows, then click the Download Fetch XML button (the cloud-with-down-arrow icon in the Advanced Find toolbar). This gives you an XML file. Open it in any text editor. Here's an annotated version of what you'll see for the scenario above:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<!-- These are the columns that will appear in results -->
<attribute name="title" />
<attribute name="createdon" />
<attribute name="statuscode" />
<attribute name="incidentid" />
<!-- Order: most recent cases first -->
<order attribute="createdon" descending="true" />
<filter type="and">
<!-- Only active cases -->
<condition attribute="statecode" operator="eq" value="0" />
<!-- Cases created in the last 30 days -->
<condition attribute="createdon" operator="last-x-days" value="30" />
</filter>
<!-- Join to Account to filter on revenue tier -->
<link-entity name="account"
from="accountid"
to="customerid"
link-type="inner"
alias="acct">
<attribute name="name" alias="account_name" />
<filter>
<condition attribute="new_revenuetier" operator="eq" value="3" />
<!-- 3 = Enterprise in your choice column -->
</filter>
</link-entity>
<!-- Join to system user to filter on territory -->
<link-entity name="systemuser"
from="systemuserid"
to="ownerid"
link-type="inner"
alias="owner">
<filter>
<condition attribute="new_region" operator="eq" value="EMEA" />
</filter>
</link-entity>
<!-- LEFT OUTER join to incident resolution — this is the anti-join pattern -->
<link-entity name="incidentresolution"
from="incidentid"
to="incidentid"
link-type="outer"
alias="res">
<attribute name="incidentresolutionid" alias="resolution_id" />
</link-entity>
<!-- Filter WHERE the outer-joined resolution is NULL -->
<filter>
<condition entityname="res"
attribute="incidentresolutionid"
operator="null" />
</filter>
</entity>
</fetch>
Let's break down the key patterns in this XML.
This is the FetchXML equivalent of a SQL JOIN. The critical attributes are:
name: The logical table name you're joining tofrom: The column on the target table that holds the join key (usually the primary key)to: The column on the source table (or parent link-entity) that holds the lookuplink-type: Either "inner" (default, SQL INNER JOIN) or "outer" (SQL LEFT OUTER JOIN)alias: The reference name used when addressing columns from this table in conditionsTip
The from and to attributes are not the same order as SQL's JOIN ... ON syntax. In FetchXML, to is the column on the entity you're joining from (the parent), and from is the column on the entity you're joining to (the child). Many developers get this backwards the first time. If you get "0 records" when you expect results, swap these.
Notice that the outer join to incidentresolution includes an <attribute> for the resolution's primary key, and then a separate <filter> element at the incident level uses entityname="res" to test that attribute for null. This is the standard FetchXML anti-join: outer join to the related table, then filter where the joined record's key is null. It's identical in logic to LEFT JOIN ... WHERE joined_table.id IS NULL in SQL.
This pattern cannot be generated by the Advanced Find UI — the UI always creates inner joins for related table filters. You must write this in XML.
FetchXML allows link-entities to be nested inside other link-entities, enabling you to traverse multiple relationship hops in a single query. For example, if you wanted to filter not just on the account's revenue tier but also on the account's parent company's industry classification, you'd nest a second <link-entity> inside the account one:
<link-entity name="account"
from="accountid"
to="customerid"
link-type="inner"
alias="acct">
<filter>
<condition attribute="new_revenuetier" operator="eq" value="3" />
</filter>
<!-- Traverse from Account to Parent Account -->
<link-entity name="account"
from="accountid"
to="parentaccountid"
link-type="inner"
alias="parent_acct">
<filter>
<condition attribute="industrycode" operator="eq" value="7" />
</filter>
</link-entity>
</link-entity>
Warning
Deep nesting has real performance implications. Each link-entity adds a JOIN to the generated SQL. Dataverse imposes a maximum of 10 link-entity elements per FetchXML query. Beyond 3-4 joins on large tables, query time can degrade noticeably, especially if you're not filtering on indexed columns. The createdon, ownerid, and statecode columns are indexed on most standard tables, which is part of why those conditions run efficiently.
The Advanced Find UI only allows AND/OR logic within a single entity's filter block. If you need an OR condition that spans two related entities — "show cases where the account is Enterprise OR the case priority is Critical" — you need to write the FetchXML manually.
<filter type="or">
<condition attribute="prioritycode" operator="eq" value="1" />
<!-- Priority 1 = High/Critical -->
<condition entityname="acct" attribute="new_revenuetier" operator="eq" value="3" />
</filter>
Note that the cross-table OR requires the entityname attribute on the condition to reference the aliased link-entity. Without entityname, Dataverse interprets the condition as applying to the root entity.
When you join to related tables, you can get duplicate rows if the relationship is one-to-many in the join direction. The distinct="true" attribute on the <fetch> element eliminates duplicates — the equivalent of SQL's SELECT DISTINCT. Always include this when you're doing outer joins or one-to-many traversals to avoid inflated record counts.
Dataverse returns a maximum of 5,000 records per FetchXML page by default (configurable down to 1 via the count attribute, but not up beyond 5,000 without paging). For operational reporting exports, this matters. The page and count attributes on <fetch> control pagination:
<fetch version="1.0" mapping="logical" distinct="true" page="1" count="5000">
When working with the Advanced Find export, the UI handles this transparently — it fetches all pages before writing the Excel file. But if you're using FetchXML programmatically via the Web API, you need to handle the morerecords and paginationcookie attributes in the response to loop through large result sets.
FetchXML supports aggregation, which Advanced Find does not expose at all. This is primarily useful for dashboards and reporting rather than list views, but it's worth knowing:
<fetch aggregate="true">
<entity name="incident">
<attribute name="incidentid" aggregate="count" alias="case_count" />
<attribute name="new_revenuetier" groupby="true" alias="tier" />
</entity>
</fetch>
Aggregate FetchXML cannot be used as a saved view — it has no concept of rows to display. Use it in charts, the Web API, or report data sources.
Key insight
The FetchXML aggregate engine has a hard limit of 50,000 records in the aggregation source. If your filtered record set exceeds 50,000 rows before aggregation, Dataverse returns an error rather than a partial result. For large-volume aggregation, Synapse Link or Dataverse-to-SQL exports are more appropriate tools.
Once you've edited your FetchXML to include the outer join anti-join pattern and any other advanced constructs, you need to get it back into the application.
In the Advanced Find dialog, there's an Upload Fetch XML button (the cloud-with-up-arrow icon) next to the download button. Click it and select your modified XML file. Advanced Find will validate and attempt to render the query in its UI.
Here's the catch: if your FetchXML uses features the UI doesn't understand — including outer join anti-joins with cross-entity null conditions — the UI may render the query partially or display an error. The filters panel may show nothing, or it may show only the conditions it can represent. This does not mean the query is broken. The underlying FetchXML is intact.
Tip
After uploading complex FetchXML, always click "Results" before saving. The results view is the definitive test — if you get the expected records, the query is valid even if the filter UI looks incomplete. The saved view will execute the full FetchXML regardless of what the UI renders.
Once you've verified the results are correct, click Save As in the Advanced Find toolbar. You'll be prompted for:
Personal views are saved to your user profile in Dataverse — specifically in the userquery table. They are not part of any solution, they don't appear in the maker portal's view editor, and they cannot be directly packaged into a managed solution. This is a critical architectural distinction.
Personal views appear in the My Views section of the view selector in the relevant table's grid. They are visible only to you unless you explicitly share them.
You can share a personal view with other users or teams through a somewhat buried mechanism. In the Advanced Find toolbar, there's a Share button that opens Dataverse's standard record sharing dialog. You can grant Read access (the user can see and use the view) or Write access (they can modify and re-share it).
This leverages the same record-sharing infrastructure discussed in Column-Level Security and Record Sharing in Dataverse. Sharing a personal view doesn't copy it to the recipient — they get access to your original. If you delete the view, their access disappears.
Warning
Personal view sharing doesn't scale well. If you need 50 people to use this query, the right answer is to promote it to a System View using the Save As workflow from an admin or system customizer account, then publish it. System views live in the savedquery table, can be included in solutions, and appear in the view selector for all users who have read access to the table.
If you have System Customizer or System Administrator privileges, you can open the maker portal (make.powerapps.com), navigate to your table's Views, and manually reconstruct the query there. For simple to moderate queries, this works well. For the complex FetchXML you've written, the better approach is to create the view in Advanced Find under an admin account, which automatically saves it as a system view rather than a personal view.
Alternatively, you can directly manipulate the savedquery record using the Dataverse Web API or by importing a solution that contains the view's FetchXML as a component. This is the production-grade approach for deploying complex views as part of a managed solution.
The columns displayed in your view results are controlled by <attribute> elements in the FetchXML. This applies both to the query's root entity and to any linked entities. When you save a personal view, the column layout is part of the saved FetchXML.
In the Advanced Find UI, switch to the Columns tab (the button that says "Edit Columns"). You can add columns from the primary entity and from any related entity used in the query. The UI will add the appropriate <attribute> elements to the FetchXML with auto-generated aliases.
In raw FetchXML, columns from link-entities need an alias attribute if you want them to appear with meaningful names:
<link-entity name="account"
from="accountid"
to="customerid"
link-type="inner"
alias="acct">
<attribute name="name" alias="account_name" />
<attribute name="new_revenuetier" alias="revenue_tier" />
</link-entity>
The alias value becomes the column header in the grid and in Excel exports. Choose meaningful names here — they're the column headers your ops manager will see in the spreadsheet.
The order in which <attribute> elements appear in the FetchXML, combined with the layoutxml portion of the saved view, determines column order in the grid. When editing FetchXML for a view, be aware that column order metadata lives in a separate XML structure called layoutxml — it's not part of the FetchXML itself in the saved view record.
If you're manipulating views via the Web API, the savedquery record has both a fetchxml column and a layoutxml column, and they need to be consistent. The layoutxml lists the cells (columns) with their widths; the fetchxml defines what's queried. Mismatch between the two causes columns to disappear or display incorrectly.
You've built a precise, multi-table query. Now the ops manager needs it in Excel. Advanced Find supports two fundamentally different export types, and understanding the difference prevents a lot of downstream confusion.
In the Advanced Find results view (or any model-driven view), the Export to Excel button offers "Static Worksheet." This generates an XLSX file with the current query results baked in as of the moment of export. It's a snapshot. The data doesn't refresh when the Excel file is opened.
Static exports are appropriate when:
The column set in the export matches exactly what's configured in the view — the same <attribute> aliases become column headers. For the ops manager's use case, a static export is perfectly fine.
The "Dynamic Worksheet" and "Dynamic PivotTable" options create an Excel file with an embedded OData connection back to Dataverse. When the recipient opens the file and clicks "Refresh," Excel re-runs the query against the live Dataverse environment and updates the data.
This sounds ideal for recurring operational reports, but there are significant practical constraints:
Key insight
For genuine operational reporting that needs to be reliable, refreshable, and sharable across a team, the professional answer isn't Advanced Find export — it's Power BI with a Dataverse connector, or Dataverse-to-SQL sync via Synapse Link. Advanced Find exports are best understood as power-user tools for ad hoc investigation, not as the foundation of a reporting infrastructure.
If your goal is to use the query you've built as a data source in a reporting tool, the FetchXML itself is the portable artifact. You can:
{org_url}/api/data/v9.2/{entity}s?fetchXml={encoded_xml} (GET with URL-encoded FetchXML) or via the fetchXml parameterThe FetchXML you've built and tested in Advanced Find is immediately portable to all of these contexts, which makes the UI a valuable prototyping environment even when it's not your ultimate runtime.
Advanced Find always respects Dataverse security context. This is both a feature and something that can confuse users building operational reports.
When a user runs an Advanced Find query, the results are filtered by that user's security role privileges. If the user's role grants them only "User" level read access on cases (meaning they can only see records they own), the query will return only their cases — even if the FetchXML contains no ownership filter. The security filtering happens at the platform level before the results are returned.
This matters for operational reporting: if the ops manager runs the EMEA cases query but her security role only gives her Business Unit access, she'll see EMEA cases only within her business unit. The query is correct; the results are constrained by her permissions. This is generally the right behavior, but it can cause confusion when users compare results and get different record counts.
Note
If you need a "complete" operational report that reflects all records regardless of the running user's ownership scope, the report must be run by a user with Organization-level read access, or you need to use a service account with appropriate privileges. See Model-Driven App Security: Configuring Security Roles, Field Permissions, and Team-Based Access for how access levels work.
If any of the columns in your FetchXML query are protected by column-level security profiles, users without the appropriate profile will see those columns as blank in both the view grid and the Excel export — even if the column is explicitly listed as an attribute in the FetchXML. The data is simply never sent to the client for those users.
Advanced Find queries respect record sharing. If a case was shared with the running user via explicit sharing (not through their security role), it will appear in results. This can be surprising in organizations that use widespread ad-hoc sharing, as shared records may appear in contexts where the user wouldn't otherwise have access.
Dataverse is built on Azure SQL, and query performance is heavily influenced by whether your filter conditions align with indexed columns. The following columns are indexed on standard tables and perform well as filter conditions:
statecode, statuscode (always filter these first to reduce the initial rowset)createdon, modifiedonownerid, owningteam, owningbusinessunitcustomerid)Custom columns you've added to tables are not automatically indexed. If you're running a query that filters on a custom column on a large table (hundreds of thousands of rows), you may notice significant query time. There's no self-service index management for Dataverse standard tables — you can request index creation through Microsoft support for Dynamics 365 environments, or design your data model to use indexed standard columns where possible.
Tip
Use the statecode = 0 (Active) filter as your first condition whenever possible. On tables with a mix of active and inactive records, this can reduce the working set by 60-90% before any other filter is applied, dramatically improving query performance.
distinct="true" in FetchXML forces a deduplication pass over the result set. On large result sets with multiple link-entities, this can be expensive. Only use distinct when you've confirmed that your joins actually produce duplicates. Test without distinct first — if you get unique results anyway (because all joins are many-to-one), you don't need it.
During query development, use count="50" on the <fetch> element to limit results to 50 rows. This makes iteration fast — you're confirming the query shape and column output, not validating completeness. Remove the count limit when you're confident the query is correct.
The documented maximum of 10 link-entities sounds like a lot, but complex FetchXML for data synchronization or multi-dimension reporting can approach it. In practice, queries with more than 4-5 link-entities should trigger a design review: are you really querying the right primary table? Often, changing the root entity (starting from Account instead of Case, for example) can flatten a deep join tree into a shallower one with better performance.
Apply everything in this lesson through the following scenario. Build it progressively, starting with the UI and finishing with direct FetchXML.
Scenario: Your sales team needs a list of all Opportunities that:
Step 1 — Build the base query in Advanced Find: Open Advanced Find on the Opportunity table. Add filters for:
Add columns for: Opportunity Name, Account Name, Estimated Revenue, Created On, Owner.
Verify results look reasonable.
Step 2 — Download and edit FetchXML:
Download the FetchXML. Open it in a text editor. Add a link-entity for the Quote table (quote) with link-type="outer", joined on opportunityid. Add an attribute for quoteid, then add an outer filter condition testing quoteid for null using entityname alias reference.
Add distinct="true" to the fetch element. Add count="100" temporarily.
Step 3 — Upload, verify, and save:
Upload the modified FetchXML back into Advanced Find. Click Results. Confirm that only opportunities without quotes appear. Remove the count attribute, re-upload, click Save As. Name it "Aging Open Opps — No Quote (90+ Days / $50k+)."
Step 4 — Export to Excel: With results showing, export as a Static Worksheet. Open the Excel file and verify columns match your view definition, including the account name from the link-entity.
Step 5 — Examine the saved view record (optional, advanced):
Using the Web API browser ({org_url}/api/data/v9.2/userqueries) or XrmToolBox's FetchXML Builder, retrieve the saved personal view and inspect both its fetchxml and layoutxml columns. Confirm the outer join anti-join pattern is preserved exactly as you wrote it.
The most common cause is that your null condition is on the wrong entity alias, or you've omitted the entityname attribute on the condition. The condition must use entityname="[alias]" where [alias] matches the alias attribute on the link-entity exactly. Even a capitalization mismatch will break it silently.
Check every link-entity's link-type. If any link to a table where some source records have null lookups, you're doing an inner join that excludes those records. In the ops scenario, a case with customerid = null is excluded the moment you join to the Account table with link-type="inner". Change to link-type="outer" and move the account filter into the link-entity's own filter block rather than a root-level filter.
Common causes:
aggregate="count") in a non-aggregate fetchaccount, incident, not Account or Incident)Tip
Validate your FetchXML using the XrmToolBox FetchXML Builder before uploading to Advanced Find. It provides syntax checking and lets you test against live Dataverse data with real-time record counts — far faster than the upload/test cycle in the browser.
Personal views (userquery records) are not included in solutions. If a solution import reset the environment's metadata, your personal views survive. But if the import was into a new environment, personal views don't migrate. For views that need to survive environment promotion, they must be promoted to system views and included in a solution.
This usually happens when two link-entities use the same table name (e.g., two joins to account for account and parent account) without distinct alias values. Without unique aliases, Dataverse may return data from one join where you expect the other. Always assign explicit, meaningful aliases to every link-entity, especially when joining the same table more than once.
First, check whether your most selective filter condition is on an indexed column. If not, restructure the filter to put indexed conditions first. Second, check whether you have distinct="true" on a query that doesn't need it. Third, review the number of link-entities — each additional join multiplies potential row combinations before deduplication. Fourth, consider whether this query should be a Dataverse view at all, or whether it belongs in Power BI or a reporting database where you have more control over query optimization.
Advanced Find and FetchXML represent the most powerful self-service query capability in a model-driven app — a toolkit that most users barely scratch the surface of. You now understand the full architecture: the UI generates FetchXML, FetchXML maps to SQL joins under the hood, and the UI's limits can always be bypassed by editing the XML directly.
The specific patterns you've learned — inner vs. outer joins, the anti-join pattern for "records without related records," cross-entity OR conditions, relative date operators, and the distinct and count attributes — cover the vast majority of real-world operational reporting scenarios. When a business user asks for "cases that haven't been touched" or "accounts without any open opportunities," you now have the exact FetchXML pattern to deliver that.
Personal views give power users a way to save and share complex queries without requiring system customizer access, while understanding the promotion path to system views ensures those queries can be deployed reliably across environments.
For next steps, consider:
The FetchXML you've written in Advanced Find is immediately transferable to Power Automate, Power BI, and the Web API — treat it as a portable query specification, not just an in-app tool. That portability is what makes mastering it worth the investment.
Model-Driven Apps & Dataverse