Project Workflow Events

Project workflow events occur when a project workflow is active. Like other document events, these events also receive a Batch object. For more information about the Batch object, see Batch Object.

ClosedProject Workflow Event Sequences

The events that occur for the project workflow commands are shown in the following lists in the sequence that they occur.

The Execute Transition event sequence and the Reroute Project event sequence do not occur in PowerWeb.

ClosedExecute Transition event sequence

  • DocGenericEvent_PrepareCommand

  • ProjectWorkflowEvent_InitializeExecuteTransition

  • ProjectWorkflowEvent_InitializeWizard

  • DocGenericEvent_OnProperties

  • ProjectWorkflowEvent_TerminateWizard

  • ProjectWorkflowEvent_BeforeExecuteTransition

  • ProjectWorkflowEvent_AfterExecuteTransition

  • ProjectWorkflowEvent_TerminateExecuteTransition

ClosedReassign Managers event sequence

  • DocGenericEvent_PrepareCommand

  • ProjectWorkflowEvent_InitializeChangeWFManager

  • ProjectWorkflowEvent_BeforeChangeWFManager

  • ProjectWorkflowEvent_AfterChangeWFManager

  • ProjectWorkflowEvent_TerminateChangeWFManager

ClosedReroute Project event sequence

  • DocGenericEvent_PrepareCommand

  • ProjectWorkflowEvent_InitializeReroute

  • ProjectWorkflowEvent_BeforeReroute

  • ProjectWorkflowEvent_AfterReroute

  • ProjectWorkflowEvent_TerminateReroute

Closed*ChangeManager Events

Occurs when a project copy is discarded from a project workflow.

Syntax

DocProjectCopyEvent_*DiscardFromProject (Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Manager

An object that represents the user who is the manager of the workflow.

Comment

A string containing the text typed by the user who is changing the workflow manager.

Closed*ExecuteTransition Events

Occurs when a project workflow transition is executed.

Syntax

ProjectWorkflowEvent_*ExecuteTransition (Batch, Transition, Manager, Comment)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Transition

A WorkflowTransition object that represents the transition to run. For more information about the WorkflowTransition object, see WorkflowTransition Object.

Manager

An object that represents the user who is the manager of the workflow.

Comment

A string containing the text typed by the user who is changing the workflow manager.

Closed*Reroute Events

Occurs when a project workflow is rerouted to a selected state.

Syntax

ProjectWorkflowEvent_*ExecuteTransition (Batch, Transition, Manager, Comment)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

State

A WorkflowState object that represents the transition to run. For more information about the WorkflowState object, see WorkflowState Object.

Manager

An object that represents the user who is the manager of the workflow.

Comment

A string containing the text typed by the user who is changing the workflow manager.

ClosedBeforeExpandItem Event

Occurs before the folder selection dialog box is shown to the user to select a destination folder for a project copy. This event does not occur in PowerWeb.

Syntax

ProjectWorkflowEvent_InitializeExpandItem (SubItems)
Parameters
Name Description

SubItems

A variant array with an item for each subfolder of the folder to be expanded. Each element is a variant array with the following elements:

  1. ID of the subfolder

  2. Display name of the subfolder

  3. Combination of AS_PRJITEM_FLAGS constants for the item.

    The initial value is AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_EXPANDABLE + AS_PRJITEM_MODE_SELECTABLE + AS_PRJITEM_MODE_NEWSUBFOLDERALLOWED.

  4. Value of the first property returned in the ItemProperties list by ProjectWorkflowEvent_InitializeExpandItem.

  5. Value of the second property.

  6. And so on.

Your implementation of this event should set the constants in the third element above to meet your requirements.

Remarks

Not available in PowerWeb. This event and the ProjectWorkflowEvent_InitializeExpandItem and ProjectWorkflowEvent_PrepareBrowser events can be used to restrict the destination project folder selected by a user:

  • The root folder to show

  • Whether a subfolder is visible or not

  • Whether a subfolder is selectable

  • Whether a subfolder is expandable

After the event, all of the subfolders of the current folder are handled as indicated by the constants in the updated SubItems array. If an item does not occur in the SubItems array, the AS_PRJITEM_MODE_NONE constant is assumed.

Example

Following are example implementations of this event and the ProjectWorkflowEvent_InitializeExpandItem event:

'Rules for this example:
'1. Only 2nd level folders can be selected
'2. A folder is shown only when it is open and the current user's name is on the list of users '   stored in the CreatePCUsers property that are allowed to create a project copy.
'3. Subfolders are not shown

Function ProjectWorkflowEvent_InitializeExpandItem(ItemProperties)
  lLevel = UBound (Split (Folder.Path, "\"))

  Select Case lLevel
    Case 2
      ItemProperties = Array ("ProjectControl.Open", "ProjectControl.CreatePCUsers")
  End Select
End Function

Function ProjectWorkflowEvent_BeforeExpandItem(SubItems)
  lLevel = UBound (Split (Folder.Path, "\"))

  Select Case lLevel
    Case 0 'Root folders
      For i = LBound (SubItems) To UBound (SubItems)
        If Right (SubItems (1, i), 7) = "Projects"  Then
          SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_EXPANDABLE 'Show it
        Else
          SubItems (i)(2) = AS_PRJITEM_MODE_NONE 'Hide it
        End If
      Next
    Case 1 'Work Units
      For i = LBound (SubItems) To UBound (SubItems)
        SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_EXPANDABLE
      Next
   
    Case 2 'Splits     
      For i = LBound (SubItems) To UBound (SubItems)

        If SubItems (i)(3) And InStr (User.Name & ";", SubItems (i)(4)) > 0 Then
          'The split is available, the user can choose it
          SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_SELECTABLE
        Else
          SubItems (i)(2) = AS_PRJITEM_MODE_NONE 'Hide it
        End If
      Next 
    Case Else
       'Cannot happen since everything at level 2 is not selectable 
  End Select
End Function

ClosedInitializeExpandItem Event

Occurs before the folder selection dialog is shown to the user to select a destination folder for a project copy.

Syntax

ProjectWorkflowEvent_InitializeExpandItem (ItemProperties, DialogTitle)
Parameters
Name Description

ItemProperties

An array of fully qualified property names that should be set by your implementation of the event. This array will specify property filters that are supplied to the ProjectWorkflowEvent_BeforeExpandItem event.

DialogTitle

A string containing the text to be used for the folder selection dialog title.

Remarks

Not available in PowerWeb. This event and the ProjectWorkflowEvent_BeforeExpandItem and ProjectWorkflowEvent_PrepareBrowser events can be used to restrict the destination project folder selected by a user.

ClosedInitializeWizard Event

Occurs when a project workflow transition shows a property page wizard.

Syntax

ProjectWorkflowEvent_InitializeWizard (Batch, Transition)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Transition

A WorkflowTransition object that represents the transition that is showing the wizard. For more information about the WorkflowTransition object, see WorkflowTransition Object.

ClosedPrepareBrowser Event

Occurs before the folder selection dialog box is shown for the user to select a destination folder for a project copy.

Syntax

ProjectWorkflowEvent_ PrepareBrowser(RootFolder, DialogTitle)
Parameters
Name Description

RootFolder

The path of the folder to show as the root in the Select Folder dialog.

DialogTitle

Custom title to show for the Select Folder dialog.

ExpandableSublevelLimit

Controls how many folder levels the user can expand in the Select Project dialog. Can be set to an integer value of 0 or higher.

This argument is optional. If the argument is included in your configuration, the user also sees a message in the Select Project dialog which says, "Expanding the project folder is disabled by the configuration beyond level [X]".

Remarks

This event and the ProjectWorkflowEvent_InitializeExpandItem and ProjectWorkflowEvent_BeforeExpandItem events can be used to restrict the destination project folder selected by a user.

The folder selection dialog box can be shown for new non-project copy documents by setting Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = False in the DocGenericEvent_BeforeNewDocument event. The selected folder can then be retrieved in the DocGenericEvent_DocumentFolderSelected event described in DocGenericEvent_DocumentFolderSelected event.

If the folder that was last selected by the user is a subfolder of the folder specified by RootFolder, it is selected by default in the folder selection dialog box. Otherwise, the folder specified by RootFolder is selected by default.

By default, when the project folder selection dialog box appears, the root of the vault is highlighted and can be selected. To prevent users from clicking the OK button and selecting the root and to force them to select or create a project folder, set the AS_CONFIRM_ROOT_SELECTION constant to False in this event. The default value is True.

This event does not occur in PowerWeb.

Examples

The following example shows how to initialize the Select Folder dialog box with a preset root folder. The user must then select a subfolder as the destination of the project copy.

Sub ProjectWorkflowEvent_PrepareBrowser(RootFolder, DialogTitle)
    RootFolder = "\projects"
    DialogTitle = "Select Project"
End Sub

The following example demonstrates how to assign a project copy to a known destination project folder (retrieved from a document property, for example) and how to suppress the Select Folder and Reference Explorer (for reference selection if references exist) dialog boxes. The DocCopyMoveEvent_PrepareCopy event occurs before ProjectWorkflowEvent_PrepareBrowser and in this example, the browser is not shown.

Sub DocCopyMoveEvent_PrepareCopy(Batch, TargetFolder)
  If Not Document Is Nothing Then
    If Client.ImportType = AS_IT_COPIED And _
      Client.ImportDetails = AS_ID_CREATEPROJCOPY Then
      'Add your code for document objects
      TargetFolder = "\Design\Projects\894" 'Or some property value
      'Suppress folder selection dialog
      Client.Confirmation(AS_CONFIRM_PROJECT_FOLDER) = False
      'Suppress reference selection dialog
      Client.Confirmation(AS_CONFIRM_SELECT_ASSEMBLY_ITEMS) = False
    End If
  ElseIf Not Folder Is Nothing Then
    'Add your code for folder objects
  End If
End Sub

ClosedTerminateWizard Event

Occurs when a project workflow transition shows a property page wizard.

Syntax

ProjectWorkflowEvent_TerminateWizard (Batch, Transition)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Transition

A WorkflowTransition object that represents the transition that is showing the wizard. For more information about the WorkflowTransition object, see WorkflowTransition Object.

Remarks

Not available in PowerWeb.

2022 R2