I have designed a bpmn file to extract some orders with a webservice task.( see the attachement).
<img src="/uploads/default/original/2X/7/70d23ac2955a8e41b8146c98711efaaaaecc32f0.png" width=“586” height="92
I have an issue in saving the processInstanceId in DB. Before starting this process I create a record in DB with processname and updating the same record with the processInstanceId once I receive the response (I use the rest api POST /process-definition/key/{key}/start to trigger the process) from the REST call. However I am getting the response only after the whole process is completed. So what happens is , there are other DB calls within the service task that looks up the same record with processInstanceId fails. Because the processInstanceId might not have updated by that time.
However if I add one usertask just after the start event , it immediately returns a processInstanceId.
Is there any other way where I can get the processInstanceId immediately after the rest call.