AnsweredAssumed Answered

How to change  UserTask Form Property dynamically

Question asked by kolpona on Feb 4, 2016
Latest reply on Feb 4, 2016 by kolpona
Hello, I am new with activiti. I want to create a user task and only want to show the fields that has values. I tried several ways with no luck. Am I missing something here? Please help. My sample code for understanding my requirement:

<userTask id=“myUsertask" name=“Operate Item” activiti:async="true" activiti:exclusive="false" activiti:assignee="kermit">
        <activiti:formProperty id="Lemar” name=“Leamr cost” type="string" variable="Lemar" readable="false" writable="false"></activiti:formProperty>
     <activiti:formProperty id="Armer” name=“ Armer cost” type="string" variable="Armer" readable="false" writable="false"></activiti:formProperty>
    <activiti:taskListener event="create" class=“…..OperateCreateEventListener"></activiti:taskListener>

then in OperateCreateEventListener:
List<FormProperty> formProperties = execution.getEngineServices().getFormService()
      for (FormProperty formProperty : formProperties) {
         if (valueList.contains(formProperty.getId())) {
            int index = formProperties.indexOf(formProperty);
            boolean isReadable = execution.getEngineServices().getFormService().getTaskFormData(delegateTask.getId()).getFormProperties()
   +"is set to isReadable() =" + isReadable);

Because of readable="false", I am not getting the properties in FormProperty list. I also tried to remove the particular FormProperty from the list with no luck. I got 'true' when the remove method called, but then If I check the size of the list, it remains same. And also they all appear in the Task. I am kind of confused. Is there any other way  to do it? (Display only selective form properties).