terça-feira, 19 de novembro de 2013

ProcessMaker - Example of trigger

Hey!

My brand new addiciton is the BPM tool, ProcessMaker.

The definition of the function I'm gonna use:

PMFNewCase()

PMFNewCase() creates a new case starting in the specified task.
variant PMFNewCase(string processId, string userId, string taskId, array variables)


What does this trigger do?

processId = 790924072528a08df8f5a61099702072
userId =  468963623527b95ba2d4f36042887697

Well, my idea was that in the end of a process a new case, of another process would be started for a specific user.
The user will receive in his inbox a case already started with status "to_do". It would be as if he had received an e-mail.

Very simple and very usefull trigger.

$taskId  = '472503662528a09680c7973093755803'; //lookup the starting task's unique ID
$newCaseId = PMFNewCase('790924072528a08df8f5a61099702072', '468963623527b95ba2d4f36042887697', $taskId, array());
//if a new case was created, change its status in the database
if ($newCaseId) {
   executeQuery("UPDATE APPLICATION SET APP_STATUS='TO_DO' WHERE APP_UID='$newCaseId'");
}
else {
   $msg = "Unable to create new case." . isset(@@__ERROR__) ? @@__ERROR__ : '';
   G::SendMessageText($msg, 'ERROR');
}

Nenhum comentário:

Postar um comentário