Triggering BatchRequest from within a workflow

I have a method that is used to trigger a workflow by creating a BatchRequest.

	public static void triggerIngestTask(WorkflowClient workflowClient, IngestTask task) {
	// Set workflowId to userId
	WorkflowOptions options = WorkflowOptions.newBuilder()
			.setTaskQueue(IngestConstants.Queues.INGEST)
			.setWorkflowId(task.getTaskId())
			.setWorkflowTaskTimeout(null)
			.build();
	
	// Use workflow interface stub to initialise/signal workflow instance
	SerializedIngestWorkflow workflow = workflowClient.newWorkflowStub(SerializedIngestWorkflow.class, options);
	BatchRequest request = workflowClient.newSignalWithStartRequest();
	request.add(workflow::execute);
	request.add(workflow::addTask, task);
	workflowClient.signalWithStart(request);
}

I would also like to setup a separate workflow that is scheduled as a cron job that would trigger the workflow above. Is there a way to trigger the workflow from within a workflow using a similar approach to a BatchRequest?

At this point, signalWithStart is supported only through the WorkflowClient. So it has to be called from an activity in your case.

OK - so I can just add this code into an activity and call that activity from the workflow that is triggered via a cron schedule?

Yes, this should work.

Thanks maxim