web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Cannot create a relation based on table id in a data entity.

(0) ShareShare
ReportReport
Posted on by

I'm attempting to create a new data entity to import records into a new table. The table contains a refRecId and refTableId field as it can be related to multiple different records.

I've attempted to link to another record as read only in the data entity using this refTableId and refRecId as the relation but when I attempt to build and sync this I receive errors. 

This seems to be down to the fact that although most system fields are automatically pulled onto the data source in the data entity (and the "Dynamic fields" option is greyed out and uneditable), the table Id is not. 

I cannot past the full set of errors in, because as is the case with most sql errors like this, it actually produces 50 or so errors. However, it does state "Error Invalid column name 'TABLEID'."

I can't find a standard entity using the refRecId, refTableId combination. Is this just not compatible with data entities?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Dan Griffiths,

    I think that you getting this error because TABLEID is x++ concept only. Data Entity creates SQL view under the hood and there is no "TABLEID" in underlying tables, so SQL cannot use field in a view definition that does not exist in SQL.

    I don't think that you can use read only data source here at all.  You have to populate refRecId and refTableId in x++ code, somewhere in mapEntityTODatasource method by yourself.

  • Suggested answer
    PA-22040759-0 Profile Picture
    6,194 on at

    Dan, 

    Just adding to what Ievgen already answered. 

    You could populate the table name in stead, and in stead of populating the RecId you should probably populate the natural keys for these related records. 

    I have been building entities on top of a number of relations like that. It's not my idea of great fun. 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans