Views:

Applies to Product - Power Platform Administration

What’s happening?
The customer is seeking guidance on how to clean the Workflow table in Dynamics 365 without affecting existing flows and applications.
 

Reason:
The customer has questions regarding the impact of deleting completed system jobs on existing applications, flows, and workflows. There are concerns about whether the cleanups performed are reflecting in the database, which may be due to synchronization delays or underlying issues.
 

Resolution:
To clean the Workflow table without impacting existing flows and applications, follow these steps:
Cleaning Unused Workflows:

  1. Ensure there are no restrictions on automatic updates, as backups are automatic for online organizations.
  2. Review the Workflow table to identify workflows that are no longer in use.
  3. If possible, perform the cleanup in a sandbox environment to verify that it does not affect existing flows and applications.
  4. Start by deactivating and removing a small number of workflows, monitoring the impact before proceeding with a complete cleanup.
Deleting Completed System Jobs:
  1. To clean the Workflow table, create a bulk deletion job:
    • In the record deletion grid, select "New" to open the deletion wizard.
    • Define a query for the records you wish to delete, selecting the System Jobs table.
    • Add the following conditions to your query:
    • System Job Type equals Workflow (to target workflow records).
    • Status equals Completed (only completed workflows are valid for deletion).
    • Optionally, filter by Status Codes (success/failure/cancelled) that are valid for the completed StateCode.
    • Optionally, filter by the Completed On field to delete only older workflows.
    • Review the set of records selected for deletion to ensure accuracy.
    • Define the frequency for your bulk deletion job, either as a one-time job or scheduled to run at defined intervals.
For more details, refer to the document Clean up records from System Job (AsyncOperationBase) and Process Log (WorkflowLogBase) tables - Power Platform | Microsoft Learn.