cancel
Showing results for 
Search instead for 
Did you mean: 

Dinamic task

chicco0386
Champ on-the-rise
Champ on-the-rise
Hi,
I ask to you how can I start a task if a condition is true?

I explain me better (I hope  Smiley Happy 😞
[img]http://img146.imageshack.us/img146/8862/processimage.jpg[/img]

I want that the task between the fork and join started automatically when a condition in the fork is true.
Es:
If the document has the name == A, so the workflow start the task for a specific swimlane and move the document in a pre configured space…

Is it possible to do?
THANKS
I HOPE THAT SOMEONE RESPONSE TO ME
6 REPLIES 6

mrogers
Star Contributor
Star Contributor
Simple and stupid solution here. :wink:

How about just putting a condition into your
UfficioA task  rather than trying to put complicated constaints on the fork?

i.e if (condition) do something else do nothing inside your task A.

So your task is always run, so the fork is nice and simple,  but task A may have nothing to do.

chicco0386
Champ on-the-rise
Champ on-the-rise
Thanks for the replay, but sorry,
I want that the task UfficioA and others (UfficioB and C) will be create via dinamic script into the fork.
Like this:
In the fork (if it's possible) I put a script that see like this:
if (document name == A)then
                  start a task node where the swimlane is the UfficioA
           else if (document name == B)then
                 start a task node where the swimlane is the UfficioB
            else if (document name == B)then
                 start a task node where the swimlane is the UfficioB
             and so on
I explain me better?
It's possible?

THANKS FOR THE RESPONSES

sethatrothbury
Champ in-the-making
Champ in-the-making
You're not describing a fork, what you need to use is a decision node. A fork is used to have multiple things happen all at once, whereas a decision only allows for one thing depending on a set of criteria.

So, in your case, we'd write something like:

<decision name="WhereTo">
       <transition name="A" to="UfficioA">
         <condition>#{bpm_package.children[0].name = 'A'}</condition>
       </transition>
       <transition name="B" to="UfficioB">
         <condition>#{bpm_package.children[0].name = 'B'}</condition>
       </transition>
       <transition name="C" to="UfficioC" />
</decision>

chicco0386
Champ on-the-rise
Champ on-the-rise
You're not describing a fork, what you need to use is a decision node. A fork is used to have multiple things happen all at once, whereas a decision only allows for one thing depending on a set of criteria.

So, in your case, we'd write something like:

<decision name="WhereTo">
       <transition name="A" to="UfficioA">
         <condition>#{bpm_package.children[0].name = 'A'}</condition>
       </transition>
       <transition name="B" to="UfficioB">
         <condition>#{bpm_package.children[0].name = 'B'}</condition>
       </transition>
       <transition name="C" to="UfficioC" />
</decision>

Thanks for the replay…
This solution is near my idea.
Now my question is:
Can I do you solution dinamic?
ex.
in the decision node (I think to use it) the transitions are create at the moment (dinamic), it means that the task node UfficioA… don't exist in the jPDL code, but it is create when necessary…
for example with the condition #{bpm_package.children[0].name = 'A'} if true I create the task node UfficioA else do nothing…

I explain me better?
It's possible?
Thanks for the responses…

GOOD NIGHT… Smiley Happy

chicco0386
Champ on-the-rise
Champ on-the-rise
Please….

How do I create new task via javascript code?
I want that the task between the fork and join don't exist at the start of workflow, but they will be create during the execution of workflow…
I want that when I arrived in the fork, a javascript command create the appropriated tasks and this tasks has a transition that go to the join node…

I explain me?
Please…
I thinks that I can use the workflow javascript API…but how?

PLEASE :?

mrogers
Star Contributor
Star Contributor
I may have misunderstood you but  you don't create workflow tasks via Java Script,  the JBPM engine is responsible for creating tasks depending upon which transitions fire.

What you do is implement the logic within those tasks.   

Seth has given you an example of how to implement a decision node.