Skip to content

Fix create table ignoring solution parameter: send MSCRM.SolutionUniqueName header#191

Open
mstarodu wants to merge 1 commit into
microsoft:mainfrom
mstarodu:fix/create-table-solution-header
Open

Fix create table ignoring solution parameter: send MSCRM.SolutionUniqueName header#191
mstarodu wants to merge 1 commit into
microsoft:mainfrom
mstarodu:fix/create-table-solution-header

Conversation

@mstarodu

Copy link
Copy Markdown

Problem
create_table with solution= sent SolutionUniqueName as a URL query parameter on the CreateEntities action. Dataverse ignores unknown query options, so the request succeeded but the table always landed in the Default solution.

Fix
Send the documented MSCRM.SolutionUniqueName request header instead (same mechanism relationship creation already uses) in sync, async, and batch code paths. Updated the 3 unit tests that asserted the query-param behavior.

Ref: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/create-update-entity-definitions-using-web-api

CreateEntities was called with SolutionUniqueName as a URL query
parameter, which Dataverse silently ignores, so new tables always
landed in the Default solution. Pass the documented
MSCRM.SolutionUniqueName request header instead (matching the
existing relationship-creation code) in the sync, async, and batch
code paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mstarodu
mstarodu requested a review from a team as a code owner July 23, 2026 10:32
Copilot AI review requested due to automatic review settings July 23, 2026 10:32

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 fixes create_table(..., solution=...) incorrectly passing SolutionUniqueName as an unsupported URL query option on the CreateEntities action (which Dataverse ignores), by sending the documented MSCRM.SolutionUniqueName request header instead. This aligns table creation behavior with existing relationship-creation behavior and ensures new tables land in the intended solution.

Changes:

  • Update sync and async _create_entity to send MSCRM.SolutionUniqueName via request headers instead of URL query params.
  • Update _build_create_entity (batch/raw-request path) to set MSCRM.SolutionUniqueName on the _RawRequest.headers field rather than appending to the URL.
  • Update unit tests (sync + async) to assert header behavior and ensure the URL no longer contains SolutionUniqueName.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/PowerPlatform/Dataverse/data/_odata.py Sends MSCRM.SolutionUniqueName as a request header in the sync CreateEntities call path.
src/PowerPlatform/Dataverse/aio/data/_async_odata.py Sends MSCRM.SolutionUniqueName as a request header in the async CreateEntities call path.
src/PowerPlatform/Dataverse/data/_odata_base.py Updates the raw/batch request builder for CreateEntities to carry the solution as a header (not a URL query param).
tests/unit/data/test_odata_internal.py Updates sync unit tests to validate header injection and ensure the URL does not include the solution query option.
tests/unit/aio/data/test_async_odata_internal.py Updates async unit tests to validate header injection for solution-scoped entity creation.

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

@mstarodu

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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