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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Does Dynamics AX 2012 have a way to schedule a reoccurring batch job to delete batch jobs(logs)

(0) ShareShare
ReportReport
Posted on by 140

I understand you can delete batch jobs by going to the Batch Jobs -> Functions -> Delete option and then list the status and date time criteria to delete the jobs.  Was wondering if there is a way to schedule this function as a reoccurring job versus having to manually do it every 90 days.  Otherwise, I will assume we can create this type of batch job to perform the function.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    dolee Profile Picture
    11,279 on at

    Hi,

    I assume you mean you want to delete records in the BatchJobHistory table. I don't know if there's existing function for this. But it should be fairly straight forward to write a function which is based on the SysOperationFramework (or RunbaseBatch) to delete the Batch Job history periodically.

    Kind regards,

    Dominic Lee

  • PA-22040759-0 Profile Picture
    6,194 on at

    The BatchDelete class is that class that deletes the job.

    You could have that modified to support being executed in batch itself, or even better follow Dominics suggestion to make a new batch enabled job to wrap this class (that makes it easier for you to maintain and upgrade later on).

  • Verified answer
    Karen Sorrentino Profile Picture
    140 on at

    Thanks Dominic, Using the SysOperationFramework (or RunbaseBatch) to delete the Batch Job history periodically works.

  • AliKhan Profile Picture
    5 on at

    Hi, I am new to Dynamics ax and X++. Can you share how you created a class to delete BatchJobHistory periodically.

  • Karen Sorrentino Profile Picture
    140 on at

    AliKhan,

    I created a class that extended the RunBaseBatch.  Within this class, created a dialog method to allow my user to enter either days or a date to delete the rows.  If days were entered, logic was created to convert to a date.  Another method within the class was created to actually perform the delete logic based upon the day or date parameter entered.  It would use the createedatetime field to determine which rows should be deleted off each table.  Performed the delete against the batchjob and batchjobhistory tables.   Since each of these tables have a deleteaction associated with them, any child table would also have the rows deleted.  Logic also made sure it would not remove any row that contained a status of 'Waiting', 'Hold', or 'Executing'.  

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans