Repository navigation
[Bug] Cannot create N:N relations #365
Description
Activity
Thanks for the report!
This is a Dataverse platform constraint: intersect tables for N:N relationships do not support the standard
Createmessage, which is why you're seeing error0x80040800/SdkEntityDoesNotSupportMessage. Dataverse requires using the OData `` association endpoint instead of a direct POST to the entity set.Workaround — until we add first-class N:N support in the generated service, you can call the association endpoint directly via
fetch:// Associate record1 (fromId) → record2 (toId) via the relationship const dataverseUrl = "https://<your-env>.api.crm.dynamics.com"; await fetch( `/api/data/v9.2/<from-table>s()/<relationship-name>/`, { method: "POST", headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: JSON.stringify({ "@odata.id": `/api/data/v9.2/<to-table>s()` }) } );
To disassociate, use a
DELETEto:
/api/data/v9.2/<from-table>s()/<relationship-name>()/We're logging this to our backlog to improve
pac code add-data-sourceso it either detects N:N intersect tables and generates relationship-awareassociate()/disassociate()methods, or surfaces a clear error at CLI time. We'll update this issue as we make progress.Reacted by GeorgeSounds good, thank you!
I wasn't sure if the "normal" Dataverse web API is fair game in code-apps, in terms of correctly inheriting the auth context, security roles etc., but I'm happy to hear that it is.
In the interim I have gone with "manual" intersect tables with two N:1 relationships 🙈
I have tried using the Dataverse web api from the code app, but the
fetch()fails, because it "violates the document's Content Security Policy."Am I missing something? Looks like the IFrame is preventing fetches to pass through. Am I supposed to use something from the SDK? I can't see any methods for invoking a "general" API endpoint.
Moving this to the ideas section. We still don't have a timeline for this.
- locked and limited conversation to collaborators
on Sep 29, 2026
Describe the bug
For an N:N relationship, the CLI allows to add the intersect table as a source. The generated service includes the usual methods. Attempting to create a new relation using the
create()method fails. Reading withgetAll()works.Code Apps documentation doesn't mention any limitations or recommendations around N:N relationships (that I could find).
Steps to Reproduce
pac code add-data-source -a dataverse -t <intersect-table-logical-name>Expected behavior
New record created in intersect table.
Actual behavior
Request fails with error message.
Screenshots or Error Messages
Environment information