U

7 Messages

 • 

1.8K 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?

23 Messages

 • 

1.9K Points

9 days 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)

144 Messages

 • 

9.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)

7 Messages

 • 

1.8K 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.

7 Messages

 • 

1.8K 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)

Loading...