Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By Sage12
#822523
I'm looking to migrate a substantial amount of historical data into a new process in PM so users only have one source to work with. In order to use PM as a future production system, we will need a method to migrate existing data for cases into the tool and ensure each case is at the appropriate state and assigned to the appropriate task.

It seems straight forward to collect the old system information, and walk though the various values, creating the APP_DATA array, and a simple insert into the database. (straight forward because I have not tried yet :) ).

So, has anyone tried this yet?

If so what have been your difficulties?

The first hurdle I see - -Does the assignment of a new APP_UID have a specific method? I see that the system pretty much depends on APP_UID and APP_NUMBER to be unique values, but neither is defined as unique in the table definition.
User avatar
By amosbatto
#822552
The G::generateUniqueID() function is used to create the unique IDs. There is a very tiny chance that it will generate the same UID twice. The UID fields in the database should be unique. If they aren't, then you should write code to check that you are not inserting a duplicate UID in a table.

This post will help you get started:
viewtopic.php?f=44&t=713938&p=798779#p798779

Here is how I would do it:
Code: Select all
$oldProcessId = 'XXXXXXXXXXXXXXXXXXX';
$newProcessId = 'YYYYYYYYYYYYYYYYYYYYY';
$newStartingTaskId = 'ZZZZZZZZZZZZZZZZZZ';

//look up all the existing cases from the old process:
$sql = "SELECT * FROM APPLICATION WHERE PRO_UID='$oldProcessId'";
$aCases = executeQuery($sql);

foreach ($aCases as $aCase) {
    $aCaseData = unserialize($aCase['APP_DATA']);
    PMFNewCaseImpersonate($newProcessId, $aCases['USR_UID'], $aCaseData, $newStartingTaskId);
}
However, that will only create new cases in their starting tasks with the data from the old cases. If you want to clone the cases, so they have the same number of completed tasks and the same users assigned to each task, then you need to see my clone_case2.pmx process:
viewtopic.php?f=44&t=713336&p=795791#p795791

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]