Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

How to delete data for save data per company table using set based operations

(0) ShareShare
ReportReport
Posted on by 20

I need to create batch job to delete records from a table which is saving data per company and also from related table.  I am able to delete the records using while select, but performance is very bad. Can someone please suggest me the best way to solve this problem?

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: How to delete data for save data per company table using set based operations

    Moved from Dynamics AX Forum.

    The message complains that you didn't suppress database logging, and you indeed didn't mention having code like that. Let me remind you that you should think about things that may cause the system to rollback to row-by-row processing and suppress them, if appropriate. This may include delete() method, alerts or database logging, for instance. Check out Conversion of operations from set-based to record-by-record for more details.

  • Arti bharane Profile Picture
    Arti bharane 20 on at
    RE: How to delete data for save data per company table using set based operations

    Thanks for the quick response.

    I am using D365 F&O PU 54.

    I tried  'delete_from crosscompany trvPBSMaindata'

    but getting error while executing the code 'Cannot delete multiple records in Credit card (TrvPBSMaindata). Cross company delete_from operation should skip database logging.'

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: How to delete data for save data per company table using set based operations

    A better approach is using delete_from statement and suppress all things that could cause the system to roll back to row-by-row processing.

    What is your version of AX?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans