Promote2

Promotes a process unit to a specified review level, and provides the option of attaching one or more documents.

Syntax

<HsvProcessFlow>.Promote2 lScenario, lYear, lPeriod, lEntity, lParent, lValue, vbUseAllValueMembers, bstrAnnotation, sProcessStateToPromoteTo, varabstrPaths, varabstrFiles, psNewProcessState

Argument

Description

lScenario

Long (ByVal). The member ID of the process unit's Scenario dimension member.

lYear

Long (ByVal). The member ID of the process unit's Year dimension member.

lPeriod

Long (ByVal). The member ID of the process unit's Period dimension member.

lEntity

Long (ByVal). The member ID of the process unit's child Entity dimension member.

lParent

Long (ByVal). The member ID of the process unit's parent Entity dimension member.

lValue

Long (ByVal). The member ID of the process unit's Value dimension member.

vbUseAllValueMembers

Boolean (ByVal). Determines whether process units for Value dimension members related to the lValue member are promoted. Pass TRUE to promote related process units, FALSE to promote only the process unit for the lValue member.

bstrAnnotation

String (ByVal). The comment for the promotion.

sProcessStateToPromoteTo

Integer (ByVal). The constant that identifies the level to which the process unit is being promoted. Use one of the level constants listed in Table 136, CEnumProcessFlowStates Enumeration.

varabstrPaths

String array (ByVal). The paths in which the documents to be attached have been loaded. Folders in the path are delimited by backslashes ( \ ).

This array has a one-to-one correspondence with the varabstrFiles argument’s array of filenames.

varabstrFiles

String array (ByVal). The file names of the documents to attach.

Note:

Files must be loaded in the folder specified by the corresponding item in the varabstrPaths argument’s array, otherwise an error will be thrown.

psNewProcessState

Integer. Returns the constant that identifies the level to which the process unit has been promoted. If the call to Promote succeeds, this should be equal to the constant passed in the sProcessStateToPromoteTo argument.

Example

The following subroutine promotes process units and attaches documents. The subroutine takes the following arguments:

IHsvDataSecurity.GetProcessUnitAccessRights gets the connected user’s access rights to the process unit. If the user has All access, HsvSecurityAccess.IsConnectedUserAllowedToPerformTask tests whether the connected user has been assigned to the role passed to the subroutine; if this returns TRUE, Promote2 is called.

Sub ProcPromoteAttach(lScen As Long, lYear As Long, lPer As Long, _
  lEnt As Long, lPar As Long, lVal As Long, lRoleID As Long, _
  saPaths() As String, saNames() As String, iState As Integer)
Dim cProcessFlow As HsvProcessFlow, iRetState As Integer
Dim bInRole As Boolean, lUnitRights As Long
Dim cSecurity As HsvSecurityAccess, cDataSec As IHsvDataSecurity
'g_cSession is an HsvSession object reference
Set cProcessFlow = g_cSession.ProcessFlow
Set cSecurity = g_cSession.Security
Set cDataSec = g_cSession.Security
cDataSec.GetProcessUnitAccessRights lScen, lYear, lPer, lEnt, _
  lPar, lVal, lUnitRights
If lUnitRights = HFM_ACCESS_RIGHTS_ALL Then
  cSecurity.IsConnectedUserAllowedToPerformTask lRoleID, bInRole
  If bInRole = True Then
    cProcessFlow.Promote2 lScen, lYear, lPer, lEnt, lPar, lVal, _
    False, "", iState, saPaths, saNames, iRetState
  End If
End If
End Sub