简体   繁体   English

Camunda:如何将变量从父进程传递到子进程。 (由事件开始)

[英]Camunda: How pass variable from parent process to subprocess. (which is started by event)

I have a process which creates a sub-process by event.我有一个通过事件创建子流程的流程。 I would like to pass a variable from the parent process to the sub-process.我想将一个变量从父进程传递给子进程。 One way which I found is by using:我发现的一种方法是使用:

MessageCorrelationResult result = runtimeService
    .createMessageCorrelation("newEvent")
    .setVariable(TOUR_ID, id)    //trigger instance where customer matches
    .correlateWithResult();
runtimeService.setVariable(result.getProcessInstance().getId(),"variableToSend", "val");

But, result.getProcessInstance() returns null and it seems that this is a known issue: https://app.camunda.com/jira/browse/CAM-7772但是, result.getProcessInstance()返回 null,这似乎是一个已知问题: https : result.getProcessInstance()

Do you know how can I pass variables from parent to sub process using other approach ?您知道如何使用其他方法将变量从父进程传递到子进程吗?

在此处输入图片说明

If you call a subprocess a Call Activity task, you can set up a variable mapping.如果将子流程称为调用活动任务,则可以设置变量映射。

In Mapping -> all在映射中 -> 全部

Out Mapping -> all出映射 -> 全部

In this case, all the variables available in the execution of your parent process shall be available at the sub-process.在这种情况下,执行父流程时可用的所有变量都应在子流程中可用。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM