I have a feeling this was asked before, but I cannot find it … so bear with me.
I have an order process where the businessKey should be the generated order-id from the domain. I do not want to copy this into the startform, I want to start the process, create the order and use that String as businessKey.
currently, it’s not possible to set the business key of the process instance after creation. You can only calculate the business key before or use a process variable instead of the business key.
Thanks, Philipp … I feared that this was the case. I guess my solution will be to split the process into a “kickoff” process that just has the startform and determines the business key and then starts the real process via message.
Any plans to support “lazy” business keys?
To save you some hassle, you could also use internal API to modify the business key in an execution listener on the start event. ((ExecutionEntity) execution).setBusinessKey(generatedBusinessKey) should do. Disclaimer: When using internal API, unexpected and undocumented things can happen.
Edit: This most likely only works during the transaction that creates the process instance, as the UPDATE mapping from execution to table does not contain the business key property. So make sure the code is executed before any wait state/async continuation.