Auslin
Auslin

Reputation: 41

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

Upvotes: 0

Views: 93

Answers (1)

Sneha Suresh
Sneha Suresh

Reputation: 26

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(), "${", "}"));

Upvotes: 1

Related Questions