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

Community site session details

Session Id :
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?

I have the same question (0)
  • Martin Dráb Profile Picture
    236,879 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?

  • Arti bharane Profile Picture
    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
    236,879 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.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 620

#3
Martin Dráb Profile Picture

Martin Dráb 563 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans