Request for help with Receive Task

Hi Forum Members,

I am a newbie to flowable world.
Basically , I am trying to create Receive Task which can hold the flow till triggered through API. I found through documentation that by adding triggerable=“true” in service Task that is achievable.

bpmn20.xml

  <process id="testFlow"  name="Test flow" isExecutable="true">
        <startEvent id="start" />
        <sequenceFlow sourceRef="start" targetRef="testExternalInput" />

        <serviceTask id="testExternalInput" name="test the external Input" flowable:triggerable="true"
                     flowable:delegateExpression="${testExternalInputService}" />
        <sequenceFlow sourceRef="testExternalInput" targetRef="getClientProfile" />



        <serviceTask id="getClientProfile" name="Get client profile"
                     flowable:delegateExpression="${getClientProfileService}" />
        <sequenceFlow sourceRef="getClientProfile" targetRef="getLocation" />
		
		And so on...

When I run the flow by executing the following codes

ProcessInstance instance =
            runtimeService.startProcessInstanceByKey(AppConstants.PROCESS_KEY, paramMap);		

I see the logs (following are values from instance object).

2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.s.TestExternalInputService - --------------------Inside TestTriggerableService.execute-------
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - ActivityId:null
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - ParentId:null
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - ProcessDefinitionId:prismFlow:102:99fc6980-1d40-11ea-b823-1a1dea572371
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - RootProcessInstanceId:ec14985b-2134-11ea-8f44-1a1dea572371
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - ProcessInstanceId:ec14985b-2134-11ea-8f44-1a1dea572371
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.service.AppFlowServiceImpl - Id:ec14985b-2134-11ea-8f44-1a1dea572371
2019-12-17 17:22:57 [http-nio-9000-exec-1] INFO  c.o.f.o.p.c.ProcessController - Process Instance ID:ec14985b-2134-11ea-8f44-1a1dea572371

Note: I don’t know if this task is onhold/stop waiting for external trigger . Is there any field that I can print in log to identify that ?

Now when I trigger following code as external trigger with “ec14985b-2134-11ea-8f44-1a1dea572371” as parameter

   public String triggerServiceTask(String processInstanceId) {
    log.info("triggerServiceTask: Started.");
    String response;
  
    try {
      Execution execution =
          runtimeService.createExecutionQuery().processInstanceId(processInstanceId).singleResult();
      runtimeService.trigger(execution.getId());
      response = "success";
    } catch (FlowableObjectNotFoundException e) {
      e.printStackTrace();
      response = e.getMessage();
    }
    log.info("triggerServiceTask: response -> " + response);

    return response;
  }
}
 
 
 I get the following in log 
 
` 2019-12-17 17:30:41 [http-nio-9000-exec-5] WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'processInstanceId' is not present]`
 
 And 
	 {
  "timestamp": "2019-12-18T01:30:41.806+0000",
  "status": 400,
  "error": "Bad Request",
  "message": "Required String parameter 'processInstanceId' is not present",
  "path": "/flow-orchestrator-prism/process/trigger-process/"
}

Any idea what am I missing here . Any suggestion is appreciated.

Thanks,
-Sarad

String parameter processInstanceId is missing.

runtimeService.trigger(execution.getId());

should trigger execution which waits on receive task.

Regards
Martin