Manipulating Process/Task/Activity Dates (Migration into Flowable)

For some background, I am using Flowable to replace an older workflow system. The old system used to track workflow directly in RDBMS using a series of step codes, and it kept track of what state the records were in by inserting new rows into a history table. I need to start planning out the potential approach for data migration (we are trying to avoid it, but must plan for it in the event it does happen).

Using the APIs, I can easily write some code that spins up a workflow and completes each task. So now what I have is a Flowable workflow that has the same tasks and the same users completing each task. The problem is that the dates are wildly off. Here’s a kind of simplistic example that hopefully illustrates the problem I’m trying to figure out:

I have a legacy workflow, let’s call it Workflow A, and it was started by susieq on 10/17/2021. It has one completed step, Step ABC, completed by jsmith on 10/25/2021.

I recreate this workflow in Flowable, still calling it Workflow A. When I migrate into Flowable, I can easily make susieq start Workflow A, and then have some more code that makes jsmith complete Step ABC. But Flowable will now say that Workflow A started on 11/16/2021 (the day I migrate), and Step ABC completed on 11/16/2021.

Is there an API that would let me tell Flowable to instead start Workflow A on 10/17/2021, and complete Step ABC on 10/25/2021? Or is the only solution to do the programmatic bits and then go into the history tables (ACTINST, PROCINST, and TAKSINST), start adjusting the dates by hand, and pray I don’t cause havoc?

@joram @filiphr

Any updates/advice? I was able to figure this out from a database scripting approach, but I couldn’t find anything in the APIs that I could use that would make this easier. If I could specify the initial dates on process start/task completion, I could do the entire migration via a single piece of code instead of in 2 phases.

Hey @jeff.gehly,

There is no need to ping anyone from the team to get an answer.

Since you are using the Java API for this perhaps you can look into controlling the current clock while doing your migration. e.g. through Clock#setCurrentTime.


Sorry about that. This is going to, I hope, be a big help. The Java APIs are big, and it seems I was looking in the wrong place for clock manipulation. I’ll take a look into this and see if i’m able to adjust the clock times to back-date activities. Thank you.

For those who need to look this up, the way you access the engine clock is via the process engine configuration. The basic command is


where currentJavaDate is a Java Date object of your making. You can invoke this at any time during engine creation, just before process start, or just before you complete a task. Flowable will properly deal with keeping all your historical data dated appropriately, meaning that if you wanted to start on 10/17 and complete the task on 10/25, you would first call this to set the date to 10/17, start Workflow A, then set the date to 10/25, and complete step ABC (per my above example).