Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

Posted on by Microsoft Employee

Hi All,

I have noticed that if an Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and I want to Identify deleted record so that same can be deleted from Data Warehouse (DWH).

For Example: I am pulling data (delta based on ModifiedDatetime) from [dbo].[INVENTTRANS] today and there are 1000 orders open that time.  Many of them getting cancelled by next pull and cancelled one getting deleted from [dbo].[INVENTTRANS]. As I have already pulled the open orders to Data Warehouse and many of the are cancelled and can't be found in AX so I want to deleted them from DWH.

Is there any way to identify deleted transactions in AX. We are using Microsoft Dynamics AX 2012.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

    ValidateDelete is not the correct method to hook into. Delete method is the correct one. ValidateDelete is called when a process attempts to delete a record. If the validation fails, the record isn't deleted.

    Delete method is called during delete.

    I would consider storing order lines, receipt lines etc in the dw, instead of inventTrans which changes, gets deleted, split and merged all the time.

    Why did you choose to sync InventTrans in the dw?

  • Aamir Shakeel Profile Picture
    Aamir Shakeel 190 on at
    RE: If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

    You can write code on validateDelete method to save the record Id and transaction Id of those records which get deleted due to any reason in a separate table and use that table to get the required information of deleted data.

  • Suggested answer
    Satish Panwar Profile Picture
    Satish Panwar 14,645 on at
    RE: If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

    Hi Shivendoo,

    Unfortunately there is not delete capture. You best guess is custom table to store all deletes. In your scenario you mentioned, order cancellation, but also think through what happens when order line get deleted.

    InventTrans table is too complex to accommodate all scenario that may lead to record Rd creation/deletion. Another thought would be why use InventTrans in DW, leverage parent entity instead, bit do know you have se problem there too.

    Thanks,

    Satish Panwar

    Please take time to click yes against the answer that help guide you in right direction.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

    Thanks for your response.

    There is no other way to identify deleted records. May be after joining couple of tables?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,240 Super User 2024 Season 2 on at
    RE: If Order is cancelled then data is getting deleted from [dbo].[INVENTTRANS] and i want to Identify deleted record so that same can be deleted from Data Warehouse

    Hi Shivendoo,

    One way would be enabling database log for deleted records. However, enabling it on the inventory transactions might cause performance issues.

    An alternative would be a development effort where you create a table with deleted records. This can be populated with coding the moment an inventory transaction record is deleted.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans