AnsweredAssumed Answered

How to start the task from Managed Bean?

Question asked by sherlock on Jan 28, 2013
I am using Activiti-cdi,jsf for my project.
I have a situation that i'm merging start task and task complete actions on a single page.
So  for starting the task i have given Process Definition Key as parameter and starting the task by using
And to open the assigned task
<f:event type="preRenderView"
         listener="#{businessProcess.startTask(taskId, true)}"   />
As i'm merging these  two actions on the same page, facing problems like processDefinitionKey is null or taskid is null.
So i want to write the listener action in Managed bean.
So my question is how to start the task from Managed bean to get the process variables on the UI to display..
My code is like

   <!– For create action –>
      <!– bind the key of the process to be started –>
         <f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}"  />
   <!– For pending action –>         
         <f:viewParam name="taskId" />
         <!– start working on the usertask and starting a conversation –>
      <f:event type="preRenderView"
         listener="#{businessProcess.startTask(taskId, true)}"   />
   <!– For rendering buttons –>      
      <f:event type="preRenderView"
         listener="#{customerController.renderButtons()}" />   
<h:outputText value="Incident Title" />
<h:inputText value="#{processVariables['incidentTitle']}" />
<h:outputText value="Incident Date" />
<input type="date" name="incidate" value="#{processVariables['incidentDate']}"/>

<h:commandButton value="Submit" action="#{businessProcess.startProcessByKey(processList.processDefinitionKey)}" rendered="#{customerController.renderCrtSubmitButton}" />

<h:commandButton value="Submit" action="#{businessProcess.completeTask(true)}" rendered="#{customerController.renderActSubmitbutton}" />

public class CustomerController implements Serializable {
boolean renderCrtSubmitButton;
boolean renderActSubmitbutton;
public void renderButtons()