- Mon May 01, 2017 4:37 pm
#790571
The specific problem I'm having is my calls to PMFNewCase() is only returning zeros as I loop through an array of records queried from a PM Table of imported data.
Background:
I need to pull data from an external database and create new cases for each record. Those new cases need to be routed to other personnel for their input. They submit the record back to the administrating manager for approval and create the queries that update the original table in the source database to post the changes back to the original database.
We started out trying to do all this in one process but found that the task of creating new tasks would be recursive so we broke out the task of creating the new cases that will be distributed to managers for review and edit into a separate process. So In the initial process (call it "Prepare Cases"), we query the userUid, processUID, and the taskUID and store the values in variables. The new case is in a different process, using a different task and user.
--------------------------------------------------------------------------------------------------------
Thanks!
Robert
Background:
I need to pull data from an external database and create new cases for each record. Those new cases need to be routed to other personnel for their input. They submit the record back to the administrating manager for approval and create the queries that update the original table in the source database to post the changes back to the original database.
We started out trying to do all this in one process but found that the task of creating new tasks would be recursive so we broke out the task of creating the new cases that will be distributed to managers for review and edit into a separate process. So In the initial process (call it "Prepare Cases"), we query the userUid, processUID, and the taskUID and store the values in variables. The new case is in a different process, using a different task and user.
--------------------------------------------------------------------------------------------------------
Code: Select all
The PMT_Course table has columns of the same name as the variables in the process but the process creating the new case doesn't have the same state variables. They only exist in this process as query results being passed as array variables to PMFNewCase(). What am I doing incorrectly? And is there a better way to structure the process so that it's easily maintainable by less technical personnel?//Get the userUid for the manager that start the case
@@userUid = executeQuery("select usr_uid from users where usr_firstname = 'Gal'");
//Get process UID
@@processUid = PMFGetProcessUidByName("Update Course Offering");
@@taskUid = PMFGetTaskUID("Update Course Information" ,@@processUid);
@@gridCases = executeQuery("Select * from PMT_Course where Department = 'ACCT'");
if (is_array(@@gridCases)){
foreach (@@gridCases as @@row) {
//create a new case for each course
@@caseUid = PMFNewCase($processId, $userId, $taskId, @@row);
//if there was an error, $newCase will be zero, otherwise it //will have the new case UID
//populate the new case with the variable values from the database row
if (@@caseUid) {
$c = new Cases();
$aCase = $c->loadCase(@@caseUid);
$aCase['APP_STATUS'] = 'TO_DO';
$c->updateCase(@@caseUid, $aCase);
echo "case status '$aCase{['APP_STATUS']}'";
}
}
}
Thanks!
Robert