U

9 Messages

 • 

2.1K Points

Thursday, December 12th, 2024 12:30 PM

Starting second workflow from workflow

I want to start a second workflow based on the user's input in a workflow. I get different errors (e.g. org.flowable.common.engine.impl.scripting.FlowableScriptEvaluationException) when starting the second workflow with the following script:

import com.collibra.dgc.core.api.component.workflow.WorkflowInstanceApi
import com.collibra.dgc.core.api.dto.workflow.StartWorkflowInstancesRequest

workflowInstanceApi.startWorkflowInstances(StartWorkflowInstancesRequest.builder().workflowDefinitionId(string2Uuid("XXX")).build())

Is there anything I'm missing?

26 Messages

 • 

2.2K Points

1 month ago

Is the second workflow you try to start a global workflow or a workflow for a specific community/domain/asset? In the latter case, you need to provide the relevant community/domain/asset to the second workflow in businessItemIds.

import com.collibra.dgc.core.api.model.workflow.WorkflowBusinessItemType

workflowInstanceApi.startWorkflowInstances(builders.get("StartWorkflowInstancesRequest")
    .businessItemIds([<insertuuid>])
    .businessItemType(WorkflowBusinessItemType.valueOf("ASSET"))
    .workflowDefinitionId(workflowDefinitionApi.getWorkflowDefinitionByProcessId("<insert process id>").getId())
    .formProperties()
    .build())

(edited)

153 Messages

 • 

10.9K Points

Script Task, with logging ... 

import com.collibra.dgc.core.api.dto.workflow.StartWorkflowInstancesRequest
import com.collibra.dgc.core.api.model.workflow.WorkflowBusinessItemType

import java.time.Instant
import java.time.format.DateTimeFormatter
import java.time.ZoneId

loggerApi.info("[WFL] your_workflow_name: BEGIN")
currentWFInstanceId = execution.getProcessInstanceId()
loggerApi.info("[WFL] Schedule Get CMDB Class: Current Process Instance Id: ${currentWFInstanceId}"

)long currentDateTime = Instant.now().toEpochMilli()

formattedDateTime = DateTimeFormatter
.ofPattern("EEEE, dd-MMM-yyyy HH:mm:ss")
.withZone(ZoneId.systemDefault())
.format(Instant.ofEpochMilli(currentDateTime))

execution.setVariable("SyncTaskDoc", "Sync requested on " + formattedDateTime)

loggerApi.info("[WFL] your_workflow_name: " + execution.getVariable("SyncTaskDoc"))

workflowDefinitionId = workflowDefinitionApi.getWorkflowDefinitionByProcessId("your_workflow_name_key").getId()
loggerApi.info("[WFL] your_workflow_name: starting new process instance for workflow definition id: " + workflowDefinitionId)

workflowInstanceApi.startWorkflowInstances(StartWorkflowInstancesRequest.builder()
.workflowDefinitionId(workflowDefinitionId)
.build())

loggerApi.info("[WFL] your_workflow_name: END")

(edited)

9 Messages

 • 

2.1K Points

@laurenzhiller1​ it is a global workflow (the ootb "Propose New Business Term" workflow). I think the problem is that the start form is not shown when the second process starts and then these inputs are missing in the following steps. The same is with another workflow where I have an exclusive gateway right after the start form and that fails because the variable is missing.

9 Messages

 • 

2.1K Points

I have removed the form from the Start event and into an own user task. It works now.

But I would still like to show the form in a separate window and not in the task window on the right side of the screen. I have achieved it for one user task, but can't reproduce it. What is the attribute to achieve this?

(edited)

26 Messages

 • 

2.2K Points

The purpose of a start form is really starting a workflow, i.e. filling it out and clicking "submit" kicks off the workflow. If you initiate a workflow from another workflow, the second workflow is already running and therefore the start form is skipped. As you have already found out, the solution is to use a user task directly after the start event instead of a start form.
Unfortunately, I don't know of any way to display user tasks in their own window. As far as I know, this is only possible with start forms.

9 Messages

 • 

2.1K Points

@laurenzhiller1​ Thank you. In the meantime, I have created one workflow where the user task is displayed in its own window. So it looks like it is possible somehow, but I don't know why. The form used in the task only contains a text display element. 

Loading...