Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to create read-onl...
Finance forum

How to create read-only entity on table with natural key?

(0) ShareShare
ReportReport
Posted on by 150

As I understand, I can create an entity for exporting data without a natural key required (as insert/update is not used). Is there a good guide on how to do this?

I've found a few guides but none of them work for me. 


The way I have tried to do it is to copy the table I need to the project, create a new field for it and an index with Alternate Key set to true on that field. Then I set the clustered and primary index to the one I created, save, and go create an entity using the copy as a source from the dropdown. I finish the wizard and go to the entity and change the data source back to the original table. Then I delete the copy table, save again and try to build. It gives a bunch of errors:

errors.png


Alternatively, is there any way to create an entity from SQL Code (SELECT ... join .. etc) ? Or create the view in the AXDB and sync it back to visual studio?


Categories:
  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: How to create read-only entity on table with natural key?

    No, you must create everything in VS.

  • Suggested answer
    Khushhal Garg Profile Picture
    1,514 on at
    RE: How to create read-only entity on table with natural key?

    NO to question - Alternatively, is there any way to create an entity from SQL Code (SELECT ... join .. etc) ? Or create the view in the AXDB and sync it back to visual studio?

  • Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: How to create read-only entity on table with natural key?

    To answer your other question, no, you can't generate F&O application elements from SQL code or objects in SQL database. Objects are defined in F&O; database is just a storage.

    It would also be much more difficult, because you would have to manually deal with partitions and data areas, relations, enum values, table inheritance and so on.

  • Blue Wang Profile Picture
    on at
    RE: How to create read-only entity on table with natural key?

    Hi Agneum,

    You can follow this blog to create an entity for table which don’t have natural key.

    [View:https://ontargit.com/en/create-dataentity-for-table-which-dont-have-natural-key/:750:50]

    About Read-Only entity, there's an example for that:

    [View:https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/financial/read-only-entity-financial:750:50]

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: How to create read-only entity on table with natural key?

    If you want to create an entity for a table without a natural key, you can do it like this:

    1) Copy some existing entity

    2) Remove all fields and data source from this entity

    3) Add your table as data source for the entity

    4) Change Label, PublicName and PublicCollectionName of the entity. Set ReadOnly to Yes

    5) Create a staging table for your entity, and set your entity to use it

    Build and sync.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,837 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans