Forum Discussion
- LeeBContributor II
Try
brapi.Workflow.Locking.LockWorkflowUnitDescendants etc.
If you use these in an Extender Rule you can then run via a Data Management Sequence.
Lee
- OscarContributor
Great find! However, the function asks for workflowChannelKey ... How can I generate that parameter for the suggested function:
BRApi.Workflow.Locking.LockWorkflowUnitDescendants(si, si.WorkflowClusterPk, WorkflowProfileTypes.AllProfiles, workflowChannelKey)
- LeeBContributor II
Hi Oscar,
You could leave empty to lock all channels, or specify an individual Workflow Channel, see examples below.
Dim wfChannelId As Guid = guid.Empty ' Dim wfChannelId As Guid = WorkflowChannel.NoDataLock.UniqueID ' Dim wfChannelId As Guid = WorkflowChannel.AllChannelInput.UniqueID ' Dim wfChannelId As Guid = WorkflowChannel.Standard.UniqueID
Then use:
BRapi.Workflow.Locking.LockWorkflowUnitDescendants(si, si.WorkflowClusterPk, WorkflowProfileTypes.AllProfiles, wfChannelId)
- AHardingNew Contributor II
Hi Lee
Any ideas on how to get .LockWorkflowUnitDescendants with a non standard channel (i.e. added by the customer)? The logic seems to allow express use of 'NoDataLock', 'AllChannelInput' and 'Standard', but for custom WF Channels, can't seem to identify how to get the UniqueId info.
BrAlex
- OS_PizzaContributor III
I have created the below BR and it works like a charm . Let me know if it doesn't work for you.
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
Try
Dim wfClusterPk As New WorkflowUnitClusterPk()
Dim Pname As String = "Your workflow name"
Dim Sname As String = "Scenerio name"
Dim Tname As String = "Timeperiod Eg- 2022M4"
wfClusterPk = BRAPi.Workflow.General.GetWorkflowUnitClusterPk(si,Pname,Sname,Tname)
'To Lock
Brapi.Workflow.Locking.LockWorkflowUnit(si,wfClusterPk)
'To unlock
'Brapi.Workflow.Locking.UnlockWorkflowUnit(si,wfClusterPk)
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
Related Content
- 8 months ago
- 11 months ago