cancel
Showing results for 
Search instead for 
Did you mean: 

how to call transition(task) based on a condition

seshu
Champ in-the-making
Champ in-the-making
Hi,

I am working on a work flow where i need to call a task based on a condition. i.e i will have only one button on UI and based on some condition, i will call next task. How can i achieve this functionality using alfresco javascript? You can also suggest other possible ways.

i need something like this to work
<script>
var name = bpm_package.children[0].properties["pm:type"];
if (name == "something")
{
     <transition name="escalate" to="level1" />
}
else
{
    <transition name="escalate" to="level2" >
}
script>
6 REPLIES 6

srmo642002
Champ in-the-making
Champ in-the-making
you can use decision node in your process definition

seshu
Champ in-the-making
Champ in-the-making
Hi,
Thanks for your response. I am using decision node but some how its not working and also not giving any error. It will be a great help if you tell me whats wrong with my code. Its always calling the first transistion

<decision name="escalation">
       
<transition name="SendToLvl2" to="review2" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var pwf_doctype = bpm_package.children[0].properties["pm:doctype"];
</script>
</action>
<condition>#{pwf_doctype == "somevalue"}</condition>
</transition>

<transition name="SendToLvl3" to="review3" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var pwf_doctype = bpm_package.children[0].properties["pm:doctype"];
</script>
</action>
<condition>#{pwf_doctype != "someothervalue"}</condition>
</transition>
</decision>

seshu
Champ in-the-making
Champ in-the-making
Its working after declaring variable globally. It was my mistake

<decision name="escalation">
<event type="node-enter">
           <variable name="pwf_doctype" access="write"/>
              <expression>
                  pwf_doctype = "somevalue";
              </expression>
</event>
<transition name="SendToLvl2" to="review2" >

suleyman
Champ in-the-making
Champ in-the-making
Hi,

Did you got it working like you have posten here?
I'm getting an error when I try it like this:

<event type="node-enter">
<variable name="pwf_doctype" access="write"/>
<expression>
pwf_doctype = "somevalue";
</expression>
</event>

rahul2
Champ in-the-making
Champ in-the-making
please send me your workflow and all other XML files
email : james.rah4788@gmail.com

raweck
Champ on-the-rise
Champ on-the-rise
How to assign a DecisionHandler class do a decision node? (I do not want to write script in processdefinition.xml)