AnsweredAssumed Answered

Saving form data in ACT_HI_DETAIL using REST API via PHP

Question asked by blake on Apr 12, 2012
Latest reply on Apr 12, 2012 by blake
I am using PHP and making REST calls to Activiti using their API.  When in Activiti Explorer version 5.9, I start the example "Expense process" and then continue on to enter in the "Amount" and "Motivation" and then click "Complete Task".  I see that the values from the form get inserted into the ACT_HI_DETAIL and ACT_RU_VARIABLE tables.  I then go into Queued -> Management and see the task.  I then assign the "Assignee" to myself and then enter something for the question "Do you agree?" and click "Complete Task".  I know that the ACT_RU_VARIABLE table is a temporary table in which the variables get deleted when the task is completed and the ACT_HI_DETAIL table is the one that stores the values indefinitely.

The issue that I am having is when using the API.  I have a webpage with a form and when I click submit, I then start the process by sending POST variables from my form using the following REST call.

$base_url = 'http://localhost:8080/activiti-rest/service';
$auth = array('userId' => 'kermit', 'password' => 'kermit');

$proc = array('processDefinitionId' => 'adhoc_Expense_process:1:25', 'businessKey' => 'adhoc_Expense_process_'.date("Y_m_d_H_i_s"));

$pest = new PestJSON($base_url);
$pest->setupAuth($auth['userId'], $auth['password']);

$res_process_instance = $pest->post('/process-instance',
    array(
      'processDefinitionId' => $proc['processDefinitionId'],
      'businessKey' => $proc['businessKey'],
      'Amount' => $_POST['amount'],
      'Motivation' => $_POST['motivation']
    )
  );

I see that the variables go into the ACT_RU_VARIABLE table and that the process is started.  Now when I run the API call to complete the task I do

$res_task_complete = $pest->put('/task/{task_id}/complete');

The task gets completed because I do not see it "Tasks" -> "Inbox" tab or the "Process" -> "My Instances" and the entries in the ACT_RU_VARIABLE table are gone but I do not see anything in the ACT_HI_DETAIL table where those values should remain indefinitely.  I have tried passing in an array as the second parameter for the call that completes the task but no success.

Outcomes