Forum Discussion
Hi pavel-wbr,
If by "directly call the extensibility rule from button" you mean the execute extender rule button (next to the compile rules button) and not a dashboard button, then my guess would be that your code might not be under the right "case" statement.
If you open a new Extensibility Rule you'll see that there're two areas, the "Case Is = ExtenderFunctionType.Unknown" that executes from that button and the "Case Is = ExtenderFunctionType.ExecuteDataMgmtBusinessRuleStep" that gets executed when launched from a data management step.
If this is the case, you should be ok just by moving or copying and pasting the code to this last area of the rule.
Hope this helps.
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
- FredLucas7 months agoContributor III
Hi pavel-wbr,
Have you tried refreshing the application or moving to a different workflow and get back to the one you expected to have been updated to understand if this could be due to the lack of the refresh?
Only dashboard extender rules are able to return a XFSelectionChangedTaskResult object which is the one that contains the info required for OS to refresh the workspace. If you trigger a DataManagement Sequence that triggers a dashboard extender rule your Workspace won't get refreshed automatically and you'll have to manually do it to see the outcome.
If you are looking for a way to trigger have the Workspace updated and also trigger other Data Management steps, you could have the dashboard extender launching the data management sequence for you. You might find this post interesting: https://community.onestreamsoftware.com/t5/Rules/Running-DM-package-from-the-BR-and-completing-the-workflow-step/m-p/34828#M3568
Related Content
- 11 months ago
- 6 months ago
- 2 years ago