To attach documents when starting, use Start2. To start multiple process units, use StartEx or Start2.
<HsvProcessFlow>.Start lScenario, lYear, lPeriod, lEntity, lParent, lValue, vbUseAllValueMembers, bstrAnnotation, psNewProcessState
This example creates a function that takes a process unit’s member IDs and comment string, and calls Start if certain conditions are met. The function tests for the following conditions:
If all of these conditions are met, Start is called and the function — named StartWorkflow — returns a blank String. If a condition is not met, StartWorkflow returns a String describing the unmet condition.
Function StartWorkflow(lScen As Long, lYear As Long, _ lPer As Long, lEnt As Long, lPar As Long, lVal As Long, _ sNote As String) As String Dim cProcessFlow As HsvProcessFlow, lRights As Long Dim iState As Integer, iNewState As Integer, bEnabled As Boolean Dim cDataSec As IHsvDataSecurity, cScenario As HsvScenarios Set cDataSec = m_cSession.Security Set cProcessFlow = m_cSession.ProcessFlow Set cScenario = m_cMetadata.Scenarios cScenario.SupportsProcessFlow lScen, bEnabled If bEnabled = True Then cDataSec.GetProcessUnitAccessRightsAndState lScen, _ lYear, lPer, lEnt, lPar, lVal, lRights, iState If lRights = HFM_ACCESS_RIGHTS_ALL Then If iState = 1 Then cProcessFlow.Start lScen, lYear, lPer, lEnt, lPar, _ lVal, False, sNote, iNewState StartWorkflow = "" Else StartWorkflow = "Invalid state; state must be Not Started" End If Else StartWorkflow = "User does not have All access rights" End If Else StartWorkflow = "Scenario not enabled for process management" End If End Function