Search code examples
formsflow.aiformsflow

Does formsflow support setting user task extension value as a variable?


Instead of hardcoding the value of formName in the task extension property of modeler, I need to place the formName value as a variable(e.g., ${formname}). enter image description here


Solution

  • This is implemented in one of our listeners i.e; FormConnectorListener to get the extension property value in dynamic. Please refer https://github.com/AOT-Technologies/forms-flow-ai/blob/master/forms-flow-bpm/src/main/java/org/camunda/bpm/extension/hooks/listeners/task/FormConnectorListener.java

    You can add a java listener that should implement org.camunda.bpm.engine.delegate.JavaDelegate and can access the extension property with the general xml api.

    public void execute(DelegateExecution execution) throws Exception {
      CamundaProperties camundaProperties = execution.getBpmnModelElementInstance().getExtensionElements().getElementsQuery()
            .filterByType(CamundaProperties.class).singleResult();
    
      Collection<CamundaProperty> properties = camundaProperties.getCamundaProperties();
      for (CamundaProperty property : properties) {
        System.out.println(property.getCamundaValue()); 
      }
    }
    

    In the above overriden method you can get the variable by using:

    
    execution.getVariable(StringUtils.substringBetween(property.getCamundaValue(), "${", "}"));