Forum Discussion

cap08's avatar
cap08
New Contributor III
9 months ago

Lock all workflows and descendants using a business rule

I'm creating a business rule to automatically lock all workflows and descendants using:   BRApi.Workflow.Locking.LockWorkflowUnitDescendants(si, wfClusterPk, profileTypeFilter, workflowChannelKey) ...
  • Krishna's avatar
    9 months ago

    cap08  - Here is an example basically it is getting the current WF Profile and locking it using extender rule.

    					Dim wfInfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si,si.WorkflowClusterPk)
    	
    	Dim A As String = wfInfo.Name
    	brapi.ErrorLog.LogMessage(si,A)
    	If wfInfo.Locked  Then
    		Brapi.ErrorLog.LogMessage(si,"Not Locked")
    		
    	Else
    		'BRApi.Workflow.Locking.LockWorkflowUnit(si,si.WorkflowClusterPk)
    		
    		
    		BRApi.Workflow.Locking.LockWorkflowUnitDescendants(si,si.WorkflowClusterPk,workflowprofiletypes.InputImportChild,si.WorkflowClusterPk.ProfileKey)
    
    		Brapi.ErrorLog.LogMessage(si," Locked")
    		
    	
    End If