Forum Discussion

psc's avatar
psc
New Contributor III
2 years ago

Workflow Steps - Stop completion of a workspace

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!

  • 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)

  • EricOsmanski's avatar
    EricOsmanski
    Valued Contributor

    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

    • psc's avatar
      psc
      New Contributor III

      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? 

      • EricOsmanski's avatar
        EricOsmanski
        Valued Contributor

        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)