Forum Discussion

jayaleck's avatar
jayaleck
New Contributor III
2 months ago
Solved

Workflow Lock / Unlock Dashboard

Was asked to create a dashboard that gives the HQ admin the ability to lock and unlock Workflow profiles. Found bits and parts to use the user POV and descendants. Unlock descendants isn't working but.. Was looking at member tree and some of the other tree functionality, but couldn't get it to work for profiles. My thought is the profile hierarchy then they would select what to lock or unlock. Was curious if anyone had any recommendations or solutions they could share? Appreciate it in advance! 

  • Figured it out, combination of the WorkflowStatus Method data adapter, BI Viewer and combo box. Here's the unlock code 

    #Region "btn_unlock_wfPOV"
    If args.FunctionName.XFEqualsIgnoreCase("UnlockwfPOV") Then
     
    Dim wfName As String = args.NameValuePairs("wfName")
     
    Dim wfChannelId As Guid = guid.Empty
     
    Dim wfClusterPk = BRAPi.Workflow.General.GetWorkflowUnitClusterPk(si,wfName,ScenarioForStatus, WFTimeForStatus)
     
    Dim profileInfos As List(Of WorkflowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, BRAPI.Workflow.General.GetWorkflowUnitClusterPk _ 
    (si,wfName,ScenarioForStatus, WFTimeForStatus),WorkflowProfileRelativeTypes.Descendants,WorkflowProfileTypes.AllProfiles)
     
    For Each profileInfo In profileInfos
    BRApi.Workflow.Locking.UnlockWorkflowUnit(si, wfClusterPk)
    BRapi.Workflow.Locking.UnlockWorkflowUnitDescendants(si, wfClusterPk, WorkflowProfileTypes.AllProfiles, wfChannelId)
     
    Next 
     
    'To change the icons
    Dim selectionResult As New XFSelectionChangedTaskResult()
    selectionResult.WorkflowWasChangedbyBusinessRule = True
    Return selectionResult
     
    End If
     
     
     

5 Replies

  • chul's avatar
    chul
    Contributor III

    Hello! The out-of-the-box UI allows you to accomplish everything you've listed in your post. I'm curious if there are specific requirements that prevent you from using it?

     

    • jayaleck's avatar
      jayaleck
      New Contributor III

      Thank you for your replay, appreciate it. They would like a dashboard where they could click on select members to lock and unlock.

      • chul's avatar
        chul
        Contributor III

        I must be missing something... the UI allows you to lock/unlock specific members by right clicking the member and selecting Lock/Unlock.

  • jayaleck's avatar
    jayaleck
    New Contributor III

    Figured it out, combination of the WorkflowStatus Method data adapter, BI Viewer and combo box. Here's the unlock code 

    #Region "btn_unlock_wfPOV"
    If args.FunctionName.XFEqualsIgnoreCase("UnlockwfPOV") Then
     
    Dim wfName As String = args.NameValuePairs("wfName")
     
    Dim wfChannelId As Guid = guid.Empty
     
    Dim wfClusterPk = BRAPi.Workflow.General.GetWorkflowUnitClusterPk(si,wfName,ScenarioForStatus, WFTimeForStatus)
     
    Dim profileInfos As List(Of WorkflowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, BRAPI.Workflow.General.GetWorkflowUnitClusterPk _ 
    (si,wfName,ScenarioForStatus, WFTimeForStatus),WorkflowProfileRelativeTypes.Descendants,WorkflowProfileTypes.AllProfiles)
     
    For Each profileInfo In profileInfos
    BRApi.Workflow.Locking.UnlockWorkflowUnit(si, wfClusterPk)
    BRapi.Workflow.Locking.UnlockWorkflowUnitDescendants(si, wfClusterPk, WorkflowProfileTypes.AllProfiles, wfChannelId)
     
    Next 
     
    'To change the icons
    Dim selectionResult As New XFSelectionChangedTaskResult()
    selectionResult.WorkflowWasChangedbyBusinessRule = True
    Return selectionResult
     
    End If