Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By awisla
#785041
Hello,
I'd like to route last task with current user logged:
I have following code from wiki:
-----------------------------
$caseId = @@APPLICATION;
//lookup the user assigned to the next task in the case
$query = "SELECT AD.DEL_INDEX, U.USR_USERNAME
FROM APP_DELEGATION AD, USERS U
WHERE AD.APP_UID='$caseId' AND
AD.DEL_INDEX=(SELECT MAX(DEL_INDEX) FROM APP_DELEGATION WHERE APP_UID='$caseId')
AND AD.USR_UID=U.USR_UID";
$result = executeQuery($query);
$nextUser = $result[1]['USR_USERNAME'];
$nextIndex = $result[1]['DEL_INDEX'];

//lookup the md5 hash for the password
$result = executeQuery("SELECT USR_PASSWORD FROM USERS WHERE USR_USERNAME='$nextUser'", 'rbac');
$nextPass = 'md5:' . $result[1]['USR_PASSWORD'];

$client = new SoapClient('http://192.168.1.76:2036/sysworkflow/en ... ices/wsdl2');
$params = array(array('userid' => $nextUser, 'password' => $nextPass));
$result = $client->__SoapCall('login', $params);

if ($result->status_code == 0)
$sessionId = $result->message;
else
die("Unable to connect to ProcessMaker.\nError Message: {$result->message}");

$params = array(array(
'sessionId'=> $sessionId,
'caseId' => @@APPLICATION,
'delIndex' => $nextIndex
));
$result = $client->__SoapCall('routeCase', $params);
if ($result->status_code != 0)
die("Error routing case: {$result->message}\n");
-----------------------------------


Code works fine, but when I want to route last task in process ( Rejected, Approved ), then the status does not change to completed.
Could you please advise what parameter should be updated in order to get process completed.

Thank you for help
Adrian
Attachments
Screen_923.jpg
Screen_923.jpg (21.9 KiB) Viewed 2842 times
User avatar
By ethanpresberg
#785050
That is not the correct way to design the process. What you are doing is essentially saying, if the manager approves it, send the case to a task called "Approved" or if he rejects it, send it to a task called "Rejected".

What you want to do is send the process through to an end event, like you have for finished. So, in your case, I would eliminate the gateway and 2 tasks, and simply connect the Manager Approval task to the Finished end event. If you want to know if the workflow is approved/rejected, just look at the variable you are saving that status in.

To take Cenforce 120mg tablet, follow the guidelin[…]

ICO software script is a pre-made program for crea[…]

A crypto exchange script is a pre-designed softwar[…]

So I recently bought an addmotor Ebike which of co[…]