Skip to content

Reject RetrieveMultiple queries filtering on non-existent attributes#342

Merged
mkholt merged 2 commits into
masterfrom
queries-filtering-on-illegal-fields-24b
Jul 8, 2026
Merged

Reject RetrieveMultiple queries filtering on non-existent attributes#342
mkholt merged 2 commits into
masterfrom
queries-filtering-on-illegal-fields-24b

Conversation

@mkholt

@mkholt mkholt commented Jul 8, 2026

Copy link
Copy Markdown
Member

Mirror Dataverse: a filter condition referencing an attribute that does not exist on the targeted entity now faults with an OrganizationServiceFault instead of being silently ignored. Validation runs after alias-filling so link-criteria conditions resolve against the correct entity's metadata, and the attribute lookup is case-sensitive.

Mirror Dataverse: a filter condition referencing an attribute that does
not exist on the targeted entity now faults with an OrganizationServiceFault
instead of being silently ignored. Validation runs after alias-filling so
link-criteria conditions resolve against the correct entity's metadata, and
the attribute lookup is case-sensitive.

Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates RetrieveMultiple behavior to better mirror Dataverse by faulting when a filter condition references an attribute that doesn’t exist on the targeted entity (including link-entity criteria), rather than silently ignoring the condition.

Changes:

  • Add filter-attribute validation to RetrieveMultipleRequestHandler after alias filling, throwing FaultException<OrganizationServiceFault> on invalid attributes (case-sensitive lookup).
  • Add unit tests covering invalid/valid attribute filters for QueryExpression, FetchExpression, and LinkEntity criteria.
  • Add required System.ServiceModel reference for the new fault-based assertions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
tests/XrmMockup365Test/TestRetrieveMultiple.cs Adds tests asserting faults for invalid filter attributes (including case-sensitivity and link criteria).
src/XrmMockup365/Requests/RetrieveMultipleRequestHandler.cs Adds validation that rejects filters referencing non-existent attributes (post-alias fill) to match Dataverse behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/XrmMockup365/Requests/RetrieveMultipleRequestHandler.cs
Comment thread src/XrmMockup365/Requests/RetrieveMultipleRequestHandler.cs
Comment thread tests/XrmMockup365Test/TestRetrieveMultiple.cs
Comment thread tests/XrmMockup365Test/TestRetrieveMultiple.cs
Comment thread tests/XrmMockup365Test/TestRetrieveMultiple.cs
Comment thread tests/XrmMockup365Test/TestRetrieveMultiple.cs
Address Copilot review feedback: FillAliasIfEmpty only assigns an alias
when it is null, so a link with an explicit empty-string EntityAlias kept
it and its criteria were skipped by the new attribute validation. Fall
back to the linked entity's logical name as the scope key so those filters
are still validated.

Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
@mkholt mkholt merged commit 0660c65 into master Jul 8, 2026
2 checks passed
@mkholt mkholt deleted the queries-filtering-on-illegal-fields-24b branch July 8, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants