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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

delete_from {data entity}

(0) ShareShare
ReportReport
Posted on by 231

I would like to confirm that I fully understand the option "Truncate entity data" in Data Management.

When this option is selected in the header of the Import group definition, it will call delete_from {Target entity} for every entity in the group definition lines.

I have found the code which does this job in the DMFEntityWriter::truncateEntityData(...) method

This function turns off delete validations and delete action restrictions:

targetData.skipDataSourceValidateDelete(true);

targetData.skipAosValidation(true);

targetData.checkRestrictedDeleteActions(false);

targetData.skipDatabaseLog(true);

targetData.selectForUpdate(true);

So in some cases it can leave some garbage data in DB and (hopefuly) rare occasions the user will not be able to import the data again?

What I would like to check is what really happens when delete_from {Data entity} is called. Does the kernel translates this to delete_from table (from the main data source) and the other tables are not touched, but delete actions (cascade delete) is working? Or is there something more?

I was trying to check the docs, but there is nothing except the example that an entity might be deleted
 
Another doubt, how does delete_from {Data entity} relates to tables where data is saved per company? According to Docs when table is per company and there is no primary company context to set it should delete only records from current company, however I have one example of such setup but truncate data entity option removed all records in all legal entities (EmployeeTable_RU table and HcmWorkerAdvHolderTableEntity entity)
I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    302,559 Super User 2025 Season 2 on at

    Hi Sebastian,

    If you enable some tracing on the development VM where you have a local SQL server, you can see what exact SQL statements will be used when it tries to delete from the {data entity}. Note that the {data entity} is a view created in the AOT and on the SQL server. Not sure what exactly will be the outcome. I can think of three scenarios (assuming it will respect the cascade delete):

    1) delete from the view

    2) delete from all tables used in the datasource definition

    3) delete from main table and use the logic for cascade delete and the delete() method.

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#1
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 391 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans