Forum Discussion
rhankey
2 years agoContributor III
How to complete an optional import/validate/load workflow channel via the api
I have an IsOptional=True direct connect Import/Validate/Load Workflow channel. I would like to be able to Complete this Workflow channel via the OS api without having to import/validate/load anythi...
- 2 years ago
rhankey - I could not able to find the BRAPI for complete WF but you can use the below to complete the WF. It will complete all the step and you can see the green check. BTW if you were able to find the API do let me know.
Note: It is working even if the optional load is set to False. So make sure you test in the Test environment before running in Production.
BRApi.Workflow.Status.SetWorkflowStatus(si, si.WorkflowClusterPk, StepClassificationTypes.DataLoadTransform, WorkflowStatusTypes.Completed, "Auto completing Import", "Error autocompleting ", "Auto completing", Nothing) BRApi.Workflow.Status.SetWorkflowStatus(si, si.WorkflowClusterPk, StepClassificationTypes.ValidateTransform, WorkflowStatusTypes.Completed, "Auto completing Validate", "Error autocompleting ", "Auto completing", Nothing) BRApi.Workflow.Status.SetWorkflowStatus(si, si.WorkflowClusterPk, StepClassificationTypes.ValidateIntersection, WorkflowStatusTypes.Completed, "Auto completing Int", "Error autocompleting ", "Auto completing", Nothing) BRApi.Workflow.Status.SetWorkflowStatus(si, si.WorkflowClusterPk, StepClassificationTypes.LoadCube, WorkflowStatusTypes.Completed, "Auto completing Workspace", "Error autocompleting Load", "Auto completing", Nothing)
sameburn
OneStream Employee
2 years agoFor your particular use case sounds like you want to bypass real WF actions and just set WF step to complete. If this is the case you can achieve this with a workspace as your final WF step and use something similar to the api's Krishna has shared via a Dashboard Extender BR (using XFSelectionChangedTaskResult object) to complete e.g something like this?
Dim wfClusterPK As New WorkflowUnitClusterPk
Dim selectionChangedTaskResult As New XFSelectionChangedTaskResult()
' Pass in variables
Dim profileName As String = args.NameValuePairs.XFGetValue("WFProfile")
Dim scenario As String = args.NameValuePairs.XFGetValue("Scenario")
Dim time As String = args.NameValuePairs.XFGetValue("Time")
' Used to complete a workspace
wfClusterPK = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, profileName, scenario, time)
BRApi.Workflow.Status.SetWorkflowStatus(si, wfClusterPK, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, "Workspace Completed", "", "Admin clicked complete workflow", Guid.Empty)
' Used to update the wfstatus automatically
selectionChangedTaskResult.WorkflowWasChangedByBusinessRule = True
selectionChangedTaskResult.IsOK = True
selectionChangedTaskResult.ShowMessageBox = True
Return selectionChangedTaskResult
Hope this helps
rhankey
2 years agoContributor III
Thanks for the response.
Setting status StepClassificaiton.Workspace to Complete will only work if the Workflow channel is a Workspace, or the current step is a Workspace. If not, you'll get a runtime error. In my instance, I want to be completing Import/Validate/Load channels, for which Krishna's response does work.
Related Content
- 2 years ago