cancel
Showing results for 
Search instead for 
Did you mean: 

Hidden transition

calle
Champ in-the-making
Champ in-the-making
Hi
Is it possible to create a <transition> in the process definition that does not show up in the corresponding task dialog? I would like to use such a transition for a timer that auto-completes the state.

//Carl
6 REPLIES 6

mrogers
Star Contributor
Star Contributor
Yes you can.

agey
Champ in-the-making
Champ in-the-making
Hi,

Can you explain me how can I do it?

In my workflow an action is execute when event "task-end" is happened. This action checks if the user has uploaded a document. If not, the transition comes back to the node, else the transition is choosen by the user. I need that the transition that comes back to the node is hidden to the user.

Thanks a lot in advance,

calle
Champ in-the-making
Champ in-the-making
I found one way to do it and that was to implement a new Dialog for the manage-task action for the specific workflow task. Override the getAdditionalButtons() method in your extension of the ManageTaskDialog class.

This is a quite complex way to do it but it works.
//Carl

agey
Champ in-the-making
Champ in-the-making
This way is fine for me, thank you very much for your reply.

itnovum
Champ in-the-making
Champ in-the-making
About 2 years too late but for all other guys:

you can set the bpm:hiddenTransitions variable.

Example:
4 Transitions: OK, reject, timeout, canceled
only OK and rejected should be displayed to users.


(right now i only figured out to set the variable via java-code)

execute the action in the task-assign-event because it has to be done after task-create

in the action, just do
ec.setVariable("bpm_hiddenTransitions", "timeout,canceled");

and you are done.


More detailed:
<event type="task-assign">
  <action class="com.itnovum.workflow.common.SetHiddenTransitions" >
    <hiddenTransitions>canceled,timeout</hiddenTransitions>
  </action>
</event>

the java-class:
public class SetHiddenTransitions extends JBPMSpringActionHandler {
  private org.dom4j.Element hiddenTransitions;
  public void execute(ExecutionContext ec) throws Exception {
    if (hiddenTransitions == null) {
      throw new WorkflowException("hiddenTransitions has not been provided");
    }

    ec.setVariable("bpm_hiddenTransitions", hiddenTransitions.getTextTrim());
  }

  public void setHiddenTransitions(Element hiddenTransitions) {
    this.hiddenTransitions = hiddenTransitions;
  }
}

vincy
Champ in-the-making
Champ in-the-making
Hi ,

  I have created advanced workflow in share.I have assigned the review task in two person like initiator and and bpm_assignee.In reviewtask have three transitions.Cancel,Approve and Reject.If initiator review the task I want to hidden Approve ,Reject Transition .If Bpm_assignee review the task want to hidden cancel transition .I followed ur code.didnt get.Can you pls share how to do that..
<?xml version="1.0" encoding="UTF-8"?>

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"
  name="wflm:test">
  <swimlane name="initiator" />
   <start-state name="start">
   <task name="wflm:submitLeaveReviewTask" swimlane="initiator"></task>
      <transition to="StartReview"></transition>
   </start-state>
 

   <node name="StartReview">
   
      <transition to="Review"/>
         
        
      
   </node>
   <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{new Array(bpm_assignee,initiator)}</pooledactors>
        </assignment>   
    </swimlane>
   
   
<task-node name="Review">
<event type="task-create">
                <script>
                   if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                   if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                   
                     
                     
                </script>
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
                 
              
                      <variable name="initiator" access="read"></variable>
                    <variable name="bpm_assignee" access="read"></variable>
                    <expression>
                      workflowTaskId = "jbpm$"+ executionContext.getTaskInstance().getId();
                     
                        executionContext.setVariable("initiator", initiator);
                        var ticket=session.getTicket();
                        executionContext.setVariable("ticket",ticket);
                         var currentUser = (person.properties["userName"]);
                        executionContext.setVariable("currentUser",currentUser);
                        if(bpm_assignee!=null){
                        var user=(bpm_assignee.properties["cm:userName"]);
                        executionContext.setVariable("User",user);
                        }
                        
                  </expression>
           </script>
           
           </action>
           
            </event>
      
        
        
           <task name="wflm:reviewTask"  swimlane="reviewer">
         
              <event type="task-assign" >
             
            
          
                <action class="com.bpa.action.Test" >
            
                </action> 
                     
           </event>
            
     
   </task>
      <transition to="Revise" name="Cancel"></transition>
      <transition to="Approve" name="Approve"></transition>
      <transition to="Reject" name="Reject"></transition>
   </task-node>
   <task-node name="Revise">
   <task name="wflm:revisedTask"  />
      <transition to="end" name="Cancel"></transition>
   </task-node>

   <task-node name="Approve">
   <task name="wflm:approvedTask"  swimlane="initiator"/>
      <transition to="Revise" name="Cancel"></transition>
   </task-node>

   <task-node name="Reject">
   <task name="wflm:rejectedTask" />
      <transition to="end"></transition>
   </task-node>


   <end-state name="end"></end-state>
</process-definition>