We are under construction!

You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.

Forum Discussion

Marco's avatar
Marco
Contributor II
2 months ago

how to work the table WorkflowLock

Hi Everyone.

I had a Business Rule that checked the Workflow table to see if a scenario was blocked, but it always showed WFProfiles as blocked. I don’t know where this information is coming from, as those WFProfiles were unblocked in the environment but appeared as blocked in the table. How can I verify this information?

 

  • I am not sure as to why you are leveraging the table for such a check, as the lock on a WF is a combination of Workflow, Scenario and Time in combination.

    Normally we use other functionality, here is an example of a simple check:

    ' Create stringbuilder			
    Dim sb As New Text.StringBuilder
    				
    'Logic to check if a WF is locked and perform action or not
    Dim wfClusterPK As New WorkflowUnitClusterPk(si.WorkflowClusterPk.ProfileKey,si.WorkflowClusterPk.ScenarioKey,si.WorkflowClusterPk.TimeKey)
    'Get the Workflow Overall Status
    Dim wfStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk,True)
    
    'Only log the error if wfStatus NOT locked
    If Not wfStatus.Locked Then 
        	sb.AppendLine("Test 1: WF Status is NOT Locked")
    'Only log the error if wfStatus IS locked
    Else If wfStatus.Locked 
        	sb.AppendLine("Test 2: WF Status IS Locked")
    End If
    				
    ' Log Result -> Throw Error				
    Throw New XFException(Convert.ToString(sb))

    Regards, Joakim

  • I am not sure as to why you are leveraging the table for such a check, as the lock on a WF is a combination of Workflow, Scenario and Time in combination.

    Normally we use other functionality, here is an example of a simple check:

    ' Create stringbuilder			
    Dim sb As New Text.StringBuilder
    				
    'Logic to check if a WF is locked and perform action or not
    Dim wfClusterPK As New WorkflowUnitClusterPk(si.WorkflowClusterPk.ProfileKey,si.WorkflowClusterPk.ScenarioKey,si.WorkflowClusterPk.TimeKey)
    'Get the Workflow Overall Status
    Dim wfStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk,True)
    
    'Only log the error if wfStatus NOT locked
    If Not wfStatus.Locked Then 
        	sb.AppendLine("Test 1: WF Status is NOT Locked")
    'Only log the error if wfStatus IS locked
    Else If wfStatus.Locked 
        	sb.AppendLine("Test 2: WF Status IS Locked")
    End If
    				
    ' Log Result -> Throw Error				
    Throw New XFException(Convert.ToString(sb))

    Regards, Joakim