04-26-2022 10:34 AM
I am looking for a business rule or function to lock and unlock workflow and then set it as scheduled task.
04-26-2022 10:53 AM - edited 04-26-2022 10:57 AM
If you use these in an Extender Rule you can then run via a Data Management Sequence.
06-15-2022 05:09 PM
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)
06-17-2022 05:03 AM
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
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)
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
06-20-2022 05:26 AM - edited 06-20-2022 05:27 AM
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
BRapi.Workflow.Locking.LockWorkflowUnitDescendants(si, si.WorkflowClusterPk, WorkflowProfileTypes.AllProfiles, wfChannelId)
02-09-2023 02:50 AM
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.
2 weeks ago
@AHarding @lee Were you able to complete using non standard channel ? Same challenge here.
Dim wfChannelId As Guid = WorkflowChannel.<Custom channelname>
2 weeks ago
@OS_Pizza I gave up on this in the end, as found a simple, inbuilt, way the WF tool would do what I was after.
I did not realise that you could lock/unlock all WF Steps under some parent with specific WF Channel Key in one go, but it can be done easily (just in case you were unaware as I was, it is per the image below):
Sorry to have no answer for your question!