Document Generic Events

These are events that do not fall under any of the other document event categories.

ClosedDocument Generic Event Sequences

The events that occur for the document generic commands are shown in the following lists in the sequence that they occur.

ClosedChange Document Type event sequence

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_PreInitializeChangeDocumentType

  3. DocGenericEvent_InitializeChangeDocumentType

  4. DocGenericEvent_PreBeforeChangeDocumentType

  5. DocGenericEvent_BeforeChangeDocumentType

  6. DocGenericEvent_AfterChangeDocumentType

  7. DocGenericEvent_BeforeNewDocument

  8. DocGenericEvent_OnProperties

  9. DocGenericEvent_AfterNewDocument

  10. DocGenericEvent_TerminateChangeDocumentType

ClosedDelete event sequence

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializeDelete

  3. DocGenericEvent_BeforeDelete

  4. DocGenericEvent_AfterDelete

  5. DocGenericEvent_TerminateDelete

ClosedDraft Print event sequence

Does not occur in PowerWeb.

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializePrint

  3. DocGenericEvent_BeforePrint

  4. DocGenericEvent_AfterPrint

  5. DocGenericEvent_TerminatePrint

ClosedIssue New Filename event sequence

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializeCalculateFileName

  3. DocGenericEvent_TerminateCalculateFileName

ClosedNew Document event sequence

Does not occur when new documents are created by the Database Import Wizard in Configurator.

  1. DocGenericEvent_BeforeSelectDocumentType

  2. The following two events DO NOT occur when new documents are created by the Document Import tool in PowerUser:

    1. DocGenericEvent_InitializeNewDocument

    2. DocGenericEvent_InitializeCalculateFileName

  3. DocGenericEvent_SelectTarget

  4. DocGenericEvent_BeforeNewDocument

  5. The following four events occur ONLY if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = False and Document.ParentFolder is not a valid folder:

    1. ProjectWorkflowEvent_PrepareBrowser

    2. ProjectWorkflowEvent_InitializeExpandItem

    3. ProjectWorkflowEvent_BeforeExpandItem

    4. DocGenericEvent_DocumentFolderSelected

  6. DocGenericEvent_OnProperties: Does not occur when new documents are created by the Document Import tool in PowerUser.

  7. The following four events occur ONLY if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = True and Document.ParentFolder is not a valid folder.

    1. ProjectWorkflowEvent_PrepareBrowser

    2. ProjectWorkflowEvent_InitializeExpandItem

    3. ProjectWorkflowEvent_BeforeExpandItem

    4. DocGenericEvent_DocumentFolderSelected

  8. DocGenericEvent_AfterNewDocument

  9. The following two events occur ONLY if an expression is configured for the Calculate file name option of the document type:

    1. DocGenericEvent_BeforeCalculateFileName

    2. DocGenericEvent_AfterCalculateFileName

  10. The following two events DO NOT occur when new documents are created by the Document Import tool in PowerUser:

    1. DocGenericEvent_TerminateCalculateFileName

    2. DocGenericEvent_TerminateNewDocument

ClosedOpen in Application event sequence

Occurs in PowerWeb when documents are downloaded.

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializeOpenInApplication

  3. DocGenericEvent_BeforeOpenInApplication

  4. DocGenericEvent_AfterOpenInApplication

  5. DocGenericEvent_TerminateOpenInApplication

ClosedPrepare for Offline Work event sequence

Does not occur in PowerWeb.

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializePrepareForOffline

  3. DocGenericEvent_BeforePrepareForOffline

  4. DocGenericEvent_AfterPrepareForOffline

  5. DocGenericEvent_TerminatePrepareForOffline

ClosedRedline event sequence

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_BeforeEditRedlines: Does not occur in PowerWeb.

  3. DocGenericEvent_AfterEditRedlines

ClosedRefresh Thumbnail event sequence

Does not occur in PowerWeb.

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializeUpdateThumbnail: Does not occur if the Refresh thumbnail button on the Document page is clicked.

  3. DocGenericEvent_BeforeUpdateThumbnail

  4. DocGenericEvent_AfterUpdateThumbnail

  5. DocGenericEvent_TerminateUpdateThumbnail: Does not occur if the Refresh thumbnail button on the Document page is clicked.

ClosedRename event sequence

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_InitializeRename

  3. DocGenericEvent_BeforeRename

  4. DocGenericEvent_AfterRename

  5. DocGenericEvent_TerminateRename

ClosedReplace Content event sequence

Does not occur in PowerWeb.

  1. DocGenericEvent_PrepareCommand

  2. DocGenericEvent_BeforeReplaceContent

  3. DocGenericEvent_AfterReplaceContent

ClosedAfterCreateReference Event

Occurs after a reference between documents has been manually created by a user.

Syntax

DocGenericEvent_AfterCreateReference(Batch, RefType, TargetDocument, [RefDisplayName])
Parameters
Name Description

Batch

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

RefType

Name of the reference type assigned to the reference.

TargetDocument

Document object to which the reference was made.

RefDisplayName

Name that was assigned to the reference. The value may be set as described in DocGenericEvent_BeforeCreateReference event.

ClosedAfterDeleteReference Event

Occurs after a reference between documents has been manually deleted by a user.

Syntax

DocGenericEvent_AfterDeleteReference(Batch, RefType, TargetDocument, [RefDisplayName])
Parameters
Name Description

Batch

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

RefType

Name of the reference type assigned to the reference.

TargetDocument

Document object to which the reference was made.

RefDisplayName

Name that was assigned to the reference.

Remarks

If the Batch.Abort method is called in the DocGenericEvent_BeforeDeleteReference event from PowerWeb, the reference will not be deleted.

ClosedAfterEditRedlines Event

Occurs after documents are redlined by a user with the Meridian viewer.

Syntax

DocGenericEvent_AfterEditRedlines(Batch)
Parameters
Name Description

Batch

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

ClosedAfterReplaceContent Event

Occurs after a user replaces the content of documents.

Syntax

DocGenericEvent_AfterReplaceContent(Batch, SourceFile)
Parameters
Name Description

Batch

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

SourceFile

A string containing the path and filename of the source file selected by the user to replace the document's content.

ClosedBeforeCreateReference Event

Occurs before a reference between documents is manually created by a user.

Syntax

DocGenericEvent_BeforeCreateReference(Batch, RefType, TargetDocument, [RefDisplayName])
Parameters
Name Description

Batch

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

RefType

Name of the reference type that will be assigned to the reference.

TargetDocument

Document object to which the reference will be made.

RefDisplayName

Default name that will be assigned to the reference. This parameter is not supplied in all cases. The value may be set in this event procedure.

ClosedBeforeDeleteReference Event

Occurs before a reference between documents is manually deleted by a user.

Syntax

DocGenericEvent_BeforeDeleteReference(Batch, RefType, TargetDocument, [RefDisplayName])
Parameters
Name Description

Batch

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

RefType

Name of the reference type assigned to the reference.

TargetDocument

Document object to which the reference was made.

RefDisplayName

Name that was assigned to the reference.

Remarks

If the Batch.Abort method is called in this event from PowerWeb, the reference will not be deleted.

ClosedBeforeEditRedlines Event

Occurs before documents are redlined by a user with the Meridian viewer.

Syntax

DocGenericEvent_BeforeEditRedlines(Batch)
Parameters
Name Description

Batch

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

ClosedBeforeReplaceContent Event

Occurs before a user replaces the content of documents.

Syntax

DocGenericEvent_BeforeReplaceContent(Batch, SourceFile)
Parameters
Name Description

Batch

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

SourceFile

A string containing the path and filename of the source file selected by the user to replace the document's content.

Remarks

Importing a document using drag and drop on a released document will create a new revision. Depending on your organization's business process for this action, the document might need to be placed in different workflow state, for example, for review before the new content can be released. We recommend that you do that in this event.

If this event handler is not customized, an Access is denied error will result and the action will fail. If the document should remain in the released state after the import, this event handler should still be implemented to place the document in a different workflow state and then the document released in the DocGenericEvent_AfterNewDocument event handler.

By default, the redlines for the existing document content will be deleted when the content is replaced. If the redlines should be retained (to check that changes to the document have been done properly, for example), you can prevent the redlines from being deleted by setting the AS_CONFIRM_CLEANREDLINESONREPLACECONTENT constant to False in this event. The default is True.

ClosedBeforeSelectDocType Event

Outputs the list of available document types to show the user based on the type of operation being carried out such as a new document or change the document type.

Syntax

DocGenericEvent_BeforeReplaceContent(Batch, DocTypesList)
Parameters
Name Description

Batch

An object that represents the action the user has selected.

DocTypesList

A semicolon-delimited list of available document types for the action being carried out.

Remarks

This functionality is only available in PowerWeb. On wizard pages, this event is fired once.

Closed*CalculateFilename Events

Occurs when the filename of a document is calculated by its document type.

Syntax

DocGenericEvent_*CalculateFilename(Batch)
Parameters
Name Description

Batch

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

Closed*ChangeDocumentType Events

Occurs when a user changes the document type of documents. The PreInitializeChangeDocumentType and PreBeforeChangeDocumentType events can be used to add confirmation pages before the InitializeChangeDocumentType and BeforeChangeDocumentType events. These events can also be used as part of a wizard.

Syntax

DocGenericEvent_*ChangeDocumentType(Batch)

 

Parameters
Name Description

Batch

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

NewType

Passed only to the PreBeforeChangeDocumentType and BeforeChangeDocumentType procedures because at that moment the document type has not yet been changed.

OldType

Passed only to the AfterChangeDocumentType procedure because the document type has already been changed.

Remarks

Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

Closed*Delete Events

Occurs when documents or folders are deleted by a user.

Syntax

DocGenericEvent_*Delete(Batch)
Parameters
Name Description

Batch

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

Remarks

When a user deletes a folder, the Document object is Nothing. When a user deletes a document, the Document object is the document being deleted. When a user deletes a folder that contains one or more documents, the events occur once for each document and then once for the parent folder.

Example

Sub DocGenericEvent_BeforeDelete(Batch)
  If Not Document Is Nothing Then
    Batch.PrintDetails "Before delete " + Document.FileName
  ElseIf Not Folder Is Nothing Then
    Batch.PrintDetails "Before delete " + Folder.Name
  End If
End Sub

ClosedDocumentFolderSelected Event

Occurs after the project folder selection dialog box has been shown to the user to select the destination folder for a new project copy document. Also shown to select a master document folder when releasing new project documents as new master documents.

The project folder selection dialog box can be controlled with the ProjectWorkflowEvent_PrepareBrowser, ProjectWorkflowEvent_InitializeExpandItem, and ProjectWorkflowEvent_BeforeExpandItem event procedures described in Project Workflow Events.

Syntax

DocGenericEvent_DocumentFolderSelected (Batch, SelectedFolder)
Parameters
Name Description

Batch

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

SelectedFolder

The name of the folder selected by the user.

Remarks

If Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) is False after the DocGenericEvent_BeforeNewDocument event and Document.ParentFolder is not a valid folder at the time that the new document properties must be set, the folder selection dialog box is shown before the DocGenericEvent_OnProperties event in order to set the destination folder.

If Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) is True after the DocGenericEvent_OnProperties event and Document.ParentFolder is still not a valid folder, the folder selection dialog box is shown before the DocGenericEvent_AfterNewDocument event.

The selected folder is set as the Folder object in the DocGenericEvent_OnProperties and DocGenericEvent_AfterNewDocument events.

Closed*NewDocument Events

Occurs when documents are created by a user with any method (template, import, Application Integration). Also when a document is moved to a different folder or changed to a different document type.

Syntax

DocGenericEvent_*NewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
Parameters
Name Description

Batch

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

Action

A long integer that represents one or more AS_IMPORTTYPE constants.

SourceFile

A string that contains the name of the source file imported as the new document.

DocType

An object that represents the document type selected by the user for the new document.

DocTemplate

A string that contains the name of the document template selected by the user.

Remarks

We recommend not setting any property values in the BeforeNewDocument event as this might cause the document to be created in a temporary parent folder before it is moved to its final destination, which might cause conflicts with existing documents.

The Before and After procedures are invoked when documents are imported with the Document Import tool. The Initialize and Terminate procedures are not invoked by the Document Import tool and are invoked only once per batch by the PowerWebImport Documents command. The FailCurrent and Abort methods of the Batch object are also available; however, the BatchIndex property will always be 1.

When documents are imported using drag-and-drop, the source of the files cannot be determined by Meridian so the value of the Client.ClientID property is AS_CID_POWERUSER regardless of the source of the documents. For your script to know where the documents originated from to perform validation or other processing, the users must use the file commands that are provided by the Meridian application links.

Example

You can test the value of the $$ICIMP_PropInvalid batch argument to determine if property validation failed while running the Document Import tool. If the validation failed, then you can prevent the import of the failed document using code similar to the following example.

Sub DocGenericEvent_BeforeNewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
If CBool(Batch.Argument("$$ICIMP_PropInvalid")) = True Then Batch.FailCurrent("Property validation failed") End If End Sub

Use the object argument Batch.Argument("__$$RelatedProjectCopy") to obtain the project copy that is being released as a master document. It can be useful to calculate the location for the master document location if it is being created for the first time.

Use the object argument Vault.Argument("__$$RelatedTransmittal") to relate a transmittal to a new submittal. Use the object argument Vault.Argument("__$$SubmittalSender") to relate a person to a new submittal.

For more information, see Object Arguments.

ClosedOnProperties Event

Occurs when a user views or edits the property pages of a document or folder.

Syntax

DocGenericEvent_OnProperties(Command, Abort)
Parameters

Name

Description

Command

A long integer that represents one or more AS_PROP_CMD constants that indicate which button the user clicked. The constants are described in the following table.

Abort

Set to True to abort the operation.

Remarks

This event occurs in the Meridian client applications when Command includes the constants indicated in the following table.

This AS_PS_CMD_APPLY constant is represented in PowerUser only when the Finish button is clicked at the end of a wizard. In PowerWeb, it is included every time the Next button is clicked for a wizard page. Property values may not be set in PowerWeb if this constant is represented.

This event does not occur in PowerWeb when creating folders.

AS_PROP_CMD constants

Constant

Action

PowerWeb

PowerUser

AS_PS_CMD_VIEW

The user started viewing the property page.

Not Included

Included

AS_PS_CMD_EDIT

The user clicked Edit to start property page (wizard) editing.

Included

Included

AS_PS_CMD_APPLY

The user clicked Next to apply changes to the current page.

Included

Included

AS_PS_CMD_FINISH

The user clicked Finish to apply changes to the last page and stop property page (wizard) editing.

Included

Included

AS_PS_CMD_CANCEL

The user clicked Cancel to discard changes and stop property page (wizard) editing.

Not Included

Included

Use this event with much caution. In PowerUser, when Command includes AS_PS_CMD_VIEW, setting Abort to True will prevent display of all property pages. Attempting to set property values at that time can cause errors such as "The object is currently being edited by another session" and lost data.

We recommend that you not execute other actions, make modifications to the document content, invoke anything that takes a relatively long time, or invoke any user interface functions during this event. Such actions can have unexpected or unpredictable results.

Closed*OpenInApplication Events

Occurs when documents are opened by a user in their native application.

Syntax

DocGenericEvent_*OpenInApplication(Batch, AppName)
Parameters
Name Description

Batch

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

AppName

A string that contains the name of the application in which the documents will be opened. This is the name of the application registered in Windows on the user's computer for the file type of the documents.

ClosedPrepareCommand Event

Occurs after a user selects a document command on the shortcut menu to act upon the selected document.

Syntax

DocGenericEvent_PrepareCommand(Batch, CmdID)
Parameters
Name Description

Batch

An object that represents the current batch of documents.

CmdID

A string that identifies the internal name of the command. For the identifiers that may be used, see Meridian Enterprise command identifiers.

Remarks

Not available in PowerWeb. This event is intended to be used to set the Batch.ProcessAsBatch property to True before programmatically adding documents with the Batch.AddDocuments method to a batch in a custom command's Initialize event.

Closed*PrepareForOffline Events

Occurs when a user prepares documents for offline mode operation.

Syntax

DocGenericEvent_*PrepareForOffline(Batch)
Parameters
Name Description

Batch

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

Closed*Print Events

Occurs when documents are printed by a user from Meridian with the viewer. For information on configuring watermark printing with the Watermark properties, see Configure Watermark Printing.

Syntax

DocGenericEvent_*Print(Batch)
Parameters
Name Description

Batch

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

Remarks

The DocGenericEvent_AfterPrint event does not occur in PowerWeb.

Closed*Rename Events

Occurs when documents or folders are renamed by a user.

Syntax

DocGenericEvent_*Rename(Batch, NewName)
Parameters
Name Description

Batch

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

NewName

A string that contains the new name entered by a user.

ClosedSelectTarget Event

Occurs when a new document is created by the Create New and Add Document commands. This event can be used to show the user a dialog box for folder, projects, or no dialog box.

Syntax

DocGenericEvent_SelectTarget (Batch, TargetFolder, DialogToShow)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected. This event occurs once for each document in the batch.

TargetFolder

An object that represents the destination folder. This event can set the destination folder.

DialogToShow

The type of dialog box to show for project selection, one of the AS_SELECT_DIALOG_TYPE constants.

Remarks

The Document object in this event is the new document. This event is equivalent to the AS_CONFIRM_NO_SELECTPROJECTWIZARD constant. For the corresponding event for copied documents, see DocCopyMoveEvent_SelectTarget event.

Closed*UpdateThumbnail Events

Occurs when a user updates the thumbnail images of documents manually.

Syntax

DocGenericEvent_*UpdateThumbnail(Batch)
Parameters
Name Description

Batch

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

ClosedDraftPrint_SetWatermark Event

Occurs when documents are printed by a user from Meridian Explorer or PowerWeb with the viewer. For information on configuring watermark printing with the Watermark properties, see Configure Watermark Printing.

Support for PowerWeb was added in the 2022 release.

Syntax

DraftPrint_SetWatermark

Remarks

The settings Enable draft print and Enable watermarks on draft print hardcopies must be set to True as described in Configure the Application Options.

2024