首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >formsflow支持将用户任务扩展值设置为变量吗?

formsflow支持将用户任务扩展值设置为变量吗?
EN

Stack Overflow用户
提问于 2022-10-10 09:13:37
回答 1查看 26关注 0票数 0

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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访问扩展属性。

代码语言:javascript
复制
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方法中,您可以使用以下方法获得变量:

代码语言:javascript
复制
execution.getVariable(StringUtils.substringBetween(property.getCamundaValue(), "${", "}"));
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74012586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档