code: @Service
      public String startWorkflow(String name, Integer version, String correlationId, Map<String, Object> input,
                                  String externalInputPayloadStoragePath, Map<String, String> taskToDomain, WorkflowDef workflowDef) {
  
          if (workflowDef == null) {
              workflowDef = metadataService.getWorkflowDef(name, version);
              if (workflowDef == null) {
                  throw new ApplicationException(ApplicationException.Code.NOT_FOUND,
                          String.format("No such workflow found by name: %s, version: %d", name,
                                  version));
              }
  
              return workflowExecutor.startWorkflow(
                      name,
                      version,
                      correlationId,
                      input,
                      externalInputPayloadStoragePath,
                      null,
                      taskToDomain
              );
          } else {
              return workflowExecutor.startWorkflow(
                      workflowDef,
                      input,
                      externalInputPayloadStoragePath,
                      correlationId,
                      null,
                      taskToDomain
              );
          }
      }
docs: Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain.
  
  @param name                            Name of the workflow you want to start.
  @param version                         Version of the workflow you want to start.
  @param correlationId                   CorrelationID of the workflow you want to start.
  @param input                           Input to the workflow you want to start.
  @param externalInputPayloadStoragePath
  @param taskToDomain
  @param workflowDef                     - workflow definition
  @return the id of the workflow instance that can be use for tracking.