Is it possible to create a task in an existing case?

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

Moderator: amosbatto

stevensi1018
Posts: 58
Joined: Mon Jul 03, 2017 3:35 pm
Country: Canada

Is it possible to create a task in an existing case?

Unread postby stevensi1018 » Wed Sep 27, 2017 4:36 pm

I have a process that will be essentially a timer-event with a script task. In my script, I verify for a condition. If true, i want to create a TASK (entry-point or not) for a case that WAS ALREADY CREATED BEFORE THE SCRIPT TASK RAN. I can't seem to find any way to do that. I don't want to use PMFRedirectToStep() since it redirects the active user and there is no real active user (and it's etter if i just create a parallel task that can be seen in the inbox of the user)

I'm trying to do that so my intermediate timer event from all my cases are not required and I would only need one of them (easier to search and users don,t have to see that).

Thanks

amosbatto
Posts: 6161
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz
Contact:

Re: Is it possible to create a task in an existing case?

Unread postby amosbatto » Thu Sep 28, 2017 9:58 pm

You can create a process like this:
SkippableTaskWithWaitingLoop.png
SkippableTaskWithWaitingLoop.png (26.66 KiB) Viewed 331 times


In this process, it loops indefinitely until the variable @@doTask is set. If set to "yes", then Task 6 will be executed. If set to "no", then Task 6 will be skipped.

Here are the routing rules of the first gateway which is used to loop until @@doTask is set:
LoopingRoutingRule.png
LoopingRoutingRule.png (22.49 KiB) Viewed 331 times


And here are the routing rules of the second gateway which decide whether to skip Task 6 or not:
DoTaskRoutingRule2.png
DoTaskRoutingRule2.png (21.13 KiB) Viewed 331 times


If you think that the loop-around is ugly, then you can get rid of it and use PMFPauseCase() in a trigger before routing in the first task to pause the case. Then, in your external process which has a loop with a script task, use PMFSendVariables() to set the @@doTask variable, and then call PMFUnpauseCase() and then PMFDerivateCase() to move the case to the gateway. If you use this method, then here would be your process:
SkippableTaskProcess.png
SkippableTaskProcess.png (11.9 KiB) Viewed 331 times


And here would be your gateway's routing rules:
doTaskRoutingRule.png
doTaskRoutingRule.png (22.6 KiB) Viewed 331 times


Here are two sample processes:
Skippable_Task_Example-1.pmx
(114.46 KiB) Downloaded 13 times
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

stevensi1018
Posts: 58
Joined: Mon Jul 03, 2017 3:35 pm
Country: Canada

Re: Is it possible to create a task in an existing case?

Unread postby stevensi1018 » Fri Sep 29, 2017 8:08 am

Thanks a lot, didn't think about PMFPauseCase() and it does exactly what I was expecting it for


Return to “Developing processes & programming”

Who is online

Users browsing this forum: No registered users and 1 guest