Skip to main content
September 19, 2023
Solved

Workflow Steps - Stop completion of a workspace

  • September 19, 2023
  • 1 reply
  • 0 views

Hello,

Is there an event handler or dashboard extender rule that could be used to stop a user from completing a workspace if certain steps are not completed first? I have a workspace that needs to be completed, but only after the import, journals and certain forms are completed first. We don't want to lock the workspace, rather when they go click the "Complete Workspace" button it gives an error message that they need to finish the other steps first.

 

Thank you!

Best answer by EricOsmanski

You can either use the code above and explicitly get the WorkflowUnitClusterPk of each of the siblings that need to be completed and check their status, or you can use something such as the below to get a list of sibling Workflows and then loop through them.

Dim objListInput As List(Of WorkFlowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, wfClusterPk, WorkflowProfileRelativeTypes.Siblings, WorkflowProfileTypes.AllProfiles)

1 reply

September 20, 2023

In your rule (assuming it is a Dashboard Extender) which is executing the Complete for the Workspace, you can check to see whether those Workflows are complete or not with the following:

Dim wfClusterPk As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, profileName, scenarioName, timeName)

Dim wfInfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk, throwOnError)

If wfStatus.AllTasksCompleted = True Then

pscAuthor
September 20, 2023

Thanks Eric! How would you add on to the above to specify which parts of the workflow need completed? If I have this on the dashboard extender that is a sibling of the members? Let's say there are 2 import steps needing to be finished, but 1 other that is optional? Would I need to manually add the steps throughout the rule? 

September 21, 2023

You can either use the code above and explicitly get the WorkflowUnitClusterPk of each of the siblings that need to be completed and check their status, or you can use something such as the below to get a list of sibling Workflows and then loop through them.

Dim objListInput As List(Of WorkFlowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, wfClusterPk, WorkflowProfileRelativeTypes.Siblings, WorkflowProfileTypes.AllProfiles)