Message Start Event send Variable

hi!
i’m try to start process using “Message Start Event”, and its works.

i’am use Expression in Thow Message
${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(“work”).correlateWithResult()}

image

  1. how send Variable to new process using “Message Start Event” and get it back?
  2. please, recommend me a book that details how to work with Camunda

You need to create a map of variables, add the variables you want and sent it along with the message call

        Map<String, Object> vars = new HashMap<String, Object>();
        vars.put("myVariable", true);
        
        execution.getProcessEngineServices().getRuntimeService()
                .createMessageCorrelation("messageName")
                .setVariables(vars)
                .correlateAllWithResult();

thank you
maybe it’s good for java… but how i can use it in Camunda Modeler (something like expression)

this one work
${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(“work”).processInstanceBusinessKey(“Id”).setVariable(“var1”, var1).correlateWithResult()}

can i get process Id in expression?

1 Like

In the modeler you can use javascript directly - the code would look very much the same

i use this one in groovy script:
execution.setVariable(“ps_id”,execution.getProcessInstanceId())
or
execution.setVariable(“ps_id”,execution.getId())

Can you show me an example of this?