Page 1 of 1

MASS IMPORT OF HISTORICAL CASE DATA

Posted: Thu Jan 24, 2019 12:00 am
by Sage12
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.

Re: MASS IMPORT OF HISTORICAL CASE DATA

Posted: Fri Jan 25, 2019 12:52 am
by amosbatto
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