Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By maabik
I have to implement the workflow in the attached file:
In “Task 1”, when the user sends a form to be validated, two tasks will be created in parallel: “Task 2” and “Task 3”.
In “Task 3”, when the validator validates the form, “Task 4” will be created.
However, if the validator rejects the form, that will be sent to “Task 1” and “Task 2” must be ended.
My question to you is how to end a task after a validation check?can we do it using a code? Is there any trigger (code) example?
Thank you for your help.
Kind Regards.
Workflow sample.png
Workflow sample.png (16.35 KiB) Viewed 3090 times
By maabik

First, i would thank you ror your feedbak.

Actually, your code makes an end to the parallel task as expected but i have an issue. i am executing two other triggers after routing wish both are executed twice (saving and sending mail twice). those two triggers are working fine if emove the trigger that ends the parallel task. my code is the following:
Code: Select all
//set to title of other parallel task:
	$otherParallelTask = 'Task1';
	$caseTile = @@caseTitle;
	$opTaskId = PMFGetTaskUID($otherParallelTask);
	if (empty($opTaskId)) {
		throw new Exception("Task '$otherParallelTask' not found!");
	//look up other parallel task's delegation index in the database:
	$caseId = @@APPLICATION;
	$aTasks = executeQuery($sql);
	//if another open parallel task is found, then route it on:
	if (!empty($aTasks)) {
		$g = new G();
		@@ret = PMFDerivateCase($caseId, $aTasks[1]['DEL_INDEX'], false, $aTasks[1]['USR_UID']);
can you please help me on this?
User avatar
By amosbatto
What version of ProcessMaker are you using? There is a bug is some versions of PM that prevents more than one trigger from executing during routing. Try combining your triggers into one trigger. For example, if you have 2 triggers after routing, then put the code from the two triggers into one trigger.
By maabik

I am using the cloud verion of PM"3.3.0 - Enterprise Edition".
Even i combined all triggers in one, the execution is done twice (i got the results doubled).
I tried to use the function "PMFDeleteCase()" to delete the desired case but i does not work since its returned value is 0.

any suggestions please?
User avatar
By amosbatto
PMFDeleteCase() only works when deleting a case which is still in the first task of its process. If in a later task, you need to use PMFCancelCase().

This line of code:
@@ret = PMFDerivateCase($caseId, $aTasks[1]['DEL_INDEX'], false, $aTasks[1]['USR_UID']);

sets the third parameter to false, so it routes on the other parallel task without executing any of its triggers in routing.

It is impossible for me to tell you why your triggers are executing twice without seeing your process. Post the .pmx file for your process and tell me exactly which triggers are executing twice and in which task.

COME ONNNNNN GUYS :oops: Is there really no one […]

Configuracion env.ini

Hi, The default value for upload_attempts_limit_pe[…]

Hi, Please check the following links: http://pml[…]


Téléchargez des sonneries SMS, des s[…]