Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Clean up Workflow History

(0) ShareShare
ReportReport
Posted on by 80

Hi,

I would like to know if there is a way to clean up the Workflow History, because the table WorkflowTrackingTable has 3 Gb and WorkflowTrackingCommentTable has 2 Gb in the DB.

Thank you

*This post is locked for comments

  • Suggested answer
    Dick Wenning Profile Picture
    8,705 Moderator on at
    RE: Clean up Workflow History

    use command like this

    delete_from WorkflowTrackingStatusTable where WorkflowTrackingStatusTable.TrackingStatus == WorkflowTrackingStatus::Completed &&

       WorkflowTrackingStatusTable.WorkflowType == WorkflowTrackingStatusWorkflowType::Workflow && WorkflowTrackingStatusTable.modifiedDateTime < DateTimeUtil::addMonths(DateTimeUtil::utcNow(),-3);

    delete_from WorkflowTrackingStatusTable where WorkflowTrackingStatusTable.TrackingStatus == WorkflowTrackingStatus::Cancelled &&

       WorkflowTrackingStatusTable.WorkflowType == WorkflowTrackingStatusWorkflowType::Workflow && WorkflowTrackingStatusTable.modifiedDateTime < DateTimeUtil::addMonths(DateTimeUtil::utcNow(),-3);

  • Community Member Profile Picture
    on at
    Re: Clean up Workflow History

    Hi,

    There is no standard process that meets this need but I think that you can delete WorkflowTrackingStatusTable table, but with conditions.

    You can not delete records with TrackingStatus 'Pending' or 'Cancelled'. This table has a type cascade DeleteAction with WorkflowTrackingTable table, and WorkflowTrackingTable too with WorkflowTrackingCommentTable table.

  • Community Member Profile Picture
    on at
    Re: Clean up Workflow History

    Hello,

    Have you ever got an answer on this? We're facing a problem in our TEST and DEV environments where the workflow tables are bloated with rows of useless information. The workflow history form can not be opened because it freezes.

    Tried to do a delete directly on the WorkflowTrakingStatusTable and it hangs forever.

    Regards,

    Eric

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,127 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans