Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing reference links on batch insert for nullable navigation keys #941

Open
ExpDev07 opened this issue Nov 26, 2024 · 0 comments
Open

Comments

@ExpDev07
Copy link

ExpDev07 commented Nov 26, 2024

When attempting to write reference links on deep insert as seen here, it throws on #ToDictionary(...) for navigation keys that per the schema have Nullable=false, but you can actually omit them and let the API generate them (we disable validations).

Take for example schema:

<EntityType Name="purchaseInvoice">
  <Key>
    <PropertyRef Name="documentType" />
    <PropertyRef Name="no" />
  </Key>
  <Property Name="documentType" Type="Edm.String" Nullable="false" />
  <Property Name="no" Type="Edm.String" Nullable="false" MaxLength="20" />
  <NavigationProperty Name="purchaseInvoiceLines" Type="Collection(Microsoft.NAV.purchaseInvoiceLine)" Partner="purchaseInvoice" ContainsTarget="true">
    <ReferentialConstraint Property="documentType" ReferencedProperty="documentType" />
    <ReferentialConstraint Property="no" ReferencedProperty="documentNo" />
  </NavigationProperty>
</EntityType>

documentType and no can be omitted and generated by the API (despite being non-nullable per schema), however, when deep inserting with purchaseInvoiceLines, it attempts to create links and fails as it can not get them.

Anyone have any workaround that does not include having to insert invoice lines one by one?

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

No branches or pull requests

1 participant