与在modeler的任务扩展属性中硬编码formName值不同,我需要将formName值作为变量(例如${formname})。

发布于 2022-10-12 08:28:28
这是在我们的监听器之一即FormConnectorListener中实现的,以获得动态中的扩展属性值。请参阅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
您可以添加一个java侦听器,该监听器应该实现org.camunda.bpm.engine.delegate.JavaDelegate,并且可以使用通用xml访问扩展属性。
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());
}
}在上面的overriden方法中,您可以使用以下方法获得变量:
execution.getVariable(StringUtils.substringBetween(property.getCamundaValue(), "${", "}"));https://stackoverflow.com/questions/74012586
复制相似问题