Hi Aymar,
here is the code I use:
Public Function CompleteWorkflow(ByVal si As SessionInfo, ByVal wfClusterPk As WorkflowUnitClusterPk) As XFSelectionChangedTaskResult
Try
Dim selectionChangedTaskResult As New XFSelectionChangedTaskResult()
'Get the workflow Info object, retrieve and the Workspace Workflow task and set its status ti COMPLETED
Dim wfStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk, True)
Dim wfTask As TaskInfo = wfStatus.GetTask(New Guid(SharedConstants.WorkflowKeys.Tasks.Workspace))
If Not wfTask Is Nothing Then
If (debug) Then ' DEBUG - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BRApi.ErrorLog.LogMessage(si, "#DEBUG: IDB_GeneralHelper / CompleteWorkflow: ", $"task: {wfTask.Description} || status: {wfTask.Status}"
)
End If ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If wfTask.Status <> WorkflowStatusTypes.Completed Then
'Update the workspace workflow to COMPLETED
Dim wfRegClusterDesc As String = BRApi.Workflow.General.GetWorkflowUnitClusterPkDescription(si, wfClusterPk)
BRApi.Workflow.Status.SetWorkflowStatus(si, wfClusterPk, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, StringHelper.FormatMessage(Me.m_MsgWorkflowCompleted, wfRegClusterDesc), "", Me.m_MsgWorkflowCompletedReasonButton, Guid.Empty)
If (debug) Then ' DEBUG - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BRApi.ErrorLog.LogMessage(si, "#DEBUG: IDB_GeneralHelper / CompleteWorkflow: ", "step completed!"
)
End If ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
End If
End If
selectionChangedTaskResult.IsOK = True
selectionChangedTaskResult.ShowMessageBox = False
selectionChangedTaskResult.WorkflowWasChangedByBusinessRule = True
Return selectionChangedTaskResult
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
I am sure is processed it creates a debug record in Error log.
I use no args here.
It should work, I have no idea why it doesn't.
Thanks for help!
Pavel