AnsweredAssumed Answered

UserTask with an optional form

Question asked by gwaptiva on Sep 20, 2013
Latest reply on Sep 20, 2013 by gwaptiva
Sorry if the title is a bit confusing, not sure how to express this better. I'll try to explain:

Embedded Activiti 5.10


In my flow, I have a multi-instance <c>subProcess</c>, to execute x times in parallel. In the <c>subProcess</c> I define a <c>UserTask</c>, with a <c>TaskListener</c> (on <c>create</c>) to provide the <c>Task</c> with text in the user's preferred language, evaluate text variables based on the state of the system, etc.

When the user completes the <c>Task</c>, and the underlying system has state A, user should be presented with a Form to take some input that will then lead to a particular operation in the next part of the flow. However, if the system has state B, the user should not get a form upon clicking Complete.

I have defined an <c>activiti:formKey</c> attribute with a variable, and an <c>activiti:formHandlerClass</c> that extends <c>DefaultFormHandler</c> and will set the variable to the <c>formKey</c> required to produce a form in the user's preferred language. I cannot, however, let my <c>formHandlerClass</c> set the <c>formKey</c> attribute to null; that makes the entire instance go BOOM.

e.g.

<userTask id="someid" activiti:formKey="${myFormKey}" activiti:formHandlerClass="MyDefaultFormHandler">
    <extensionElements>
        <activiti:taskListener event="create" class="MyUserTaskCreator" />
    </extensionElements>
</userTask>


Is there a more elegant way to manipulate the flow to skip dealing with the formKey/formHandlerClass combination under certain circumstances (other than defining an <c>exclusiveGateway</c> before and have one <c>UserTask</c> with and one without the form)?

Hope this was clear enough, and thanks in advance for any suggestions.

Gwap

Outcomes