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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to get the query of the data entity?

(0) ShareShare
ReportReport
Posted on by 1,965

Hi,

How can i get the query of a certain data entity? 

I have the same question (0)
  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at

    Hi

    Go to the database, find the data entity in the views section of your database. here you will find the complete query of your data entity.

  • .. Profile Picture
    1,965 on at

    Hi sheikh,

    Is it normal that the query is wrong?  I mean When i try to run it i got errors. So i had to edit few lines in order for the query to run

    For example after inner join with a table there was no on conditiin directly after it it was after few lines

  • André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi IntegrationBeginner,

    You asked a question for some general information and now it appears that you have a specific issue. Can you share more details about what you are working on and what error you get?

  • .. Profile Picture
    1,965 on at

    Hi Andre,

    I took part of the query. As you can see T7 doesn't have an ON condition for the inner join

    If i move the on condition highlighted in yellow next to T7 then the query for the entity runs (as this is the relation on the entity itself) 

    But why is it wrong from the first place? 

    IMG_5F00_20211005_5F00_132650.jpg

  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at

    I am not sure what exactly is your case, but in general, with the OOTB data entity, the query should run properly without having any issues.

    If this is a custom data entity, then you need to check, how you developed the data entity. the data entity is actually viewed in the database, so what you will develop will be shown as it is in the database.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi IngegrationBeginner,

    what you see in the database is created by D365 based on the entity definition that you have developed in Visual Studio. So if you see some issues here, you must figure them out and fix them in the entity definition in the Visual Studio.

  • .. Profile Picture
    1,965 on at

    Hi nikolas and sheikh,

    But how come the entity is working correctly and i get no build errors

    I mena what should i change if i can't see any errors?

    Also i noticed that in the standard data entity ledgerjournalentity... There was no on condition next to the inner join and it was done later but it didn't fail when running it

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    You're saying that the entity is working correctly. So what exactly are you trying to achieve now? Do you have a business problem that you're trying to solve?

    Anyway, the view that you see in the database is the one that D365 creates from your entity. But the entity execution in D365 is more than just that view - so you can't always expect 1:1 results from running the entity and querying the SQL view.

  • .. Profile Picture
    1,965 on at

    Hi Nikolaos,

    So it's ok that the query is wrong even though the entity is working?

    Yes i'm trying to solve the problem described in this question.

    I'm getting repeated records when using recurring integration in a different environment

    community.dynamics.com/.../repeated-records-in-recurring-integration

  • .. Profile Picture
    1,965 on at

    I forgot to add to the previous reply the query error

    IMG_5F00_20211005_5F00_152702.jpg

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans