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

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeChangeDocumentType

  • DocGenericEvent_BeforeChangeDocumentType

  • DocGenericEvent_AfterChangeDocumentType

  • DocGenericEvent_BeforeNewDocument

  • DocGenericEvent_OnProperties

  • DocGenericEvent_AfterNewDocument

  • DocGenericEvent_TerminateChangeDocumentType

ClosedDelete event sequence

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeDelete

  • DocGenericEvent_BeforeDelete

  • DocGenericEvent_AfterDelete

  • DocGenericEvent_TerminateDelete

ClosedDraft Print event sequence 1

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializePrint

  • DocGenericEvent_BeforePrint

  • DocGenericEvent_AfterPrint

  • DocGenericEvent_TerminatePrint

ClosedIssue New Filename event sequence

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeCalculateFileName

  • DocGenericEvent_TerminateCalculateFileName

ClosedNew Document event sequence4

  • DocGenericEvent_BeforeSelectDocumentType

  • DocGenericEvent_InitializeNewDocument3

  • DocGenericEvent_InitializeCalculateFileName3

  • DocGenericEvent_SelectTarget

  • DocGenericEvent_BeforeNewDocument

  • ProjectWorkflowEvent_PrepareBrowser5

  • ProjectWorkflowEvent_InitializeExpandItem5

  • ProjectWorkflowEvent_BeforeExpandItem5

  • DocGenericEvent_DocumentFolderSelected5

  • DocGenericEvent_OnProperties3

  • ProjectWorkflowEvent_PrepareBrowser6

  • ProjectWorkflowEvent_InitializeExpandItem6

  • ProjectWorkflowEvent_BeforeExpandItem6

  • DocGenericEvent_DocumentFolderSelected6

  • DocGenericEvent_AfterNewDocument

  • DocGenericEvent_BeforeCalculateFileName8

  • DocGenericEvent_AfterCalculateFileName8

  • DocGenericEvent_TerminateCalculateFileName3

  • DocGenericEvent_TerminateNewDocument3

ClosedOpen in Application event sequence2

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeOpenInApplication

  • DocGenericEvent_BeforeOpenInApplication

  • DocGenericEvent_AfterOpenInApplication

  • DocGenericEvent_TerminateOpenInApplication

ClosedPrepare for Offline Work event sequence1

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializePrepareForOffline

  • DocGenericEvent_BeforePrepareForOffline

  • DocGenericEvent_AfterPrepareForOffline

  • DocGenericEvent_TerminatePrepareForOffline

ClosedRedline event sequence

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_BeforeEditRedlines1

  • DocGenericEvent_AfterEditRedlines

ClosedRefresh Thumbnail event sequence1

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeUpdateThumbnail7

  • DocGenericEvent_BeforeUpdateThumbnail

  • DocGenericEvent_AfterUpdateThumbnail

  • DocGenericEvent_TerminateUpdateThumbnail7

ClosedRename event sequence

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_InitializeRename

  • DocGenericEvent_BeforeRename

  • DocGenericEvent_AfterRename

  • DocGenericEvent_TerminateRename

ClosedReplace Content event sequence1

  • DocGenericEvent_PrepareCommand

  • DocGenericEvent_BeforeReplaceContent

  • DocGenericEvent_AfterReplaceContent

Notes

  1. Does not occur in PowerWeb.

  2. Occurs in PowerWeb when documents are downloaded.

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

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

  5. Occurs only if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = False and Document.ParentFolder is not a valid folder.

  6. Occurs only if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = True and Document.ParentFolder is not a valid folder.

  7. Does not occur if the Refresh thumbnail button on the Document page is clicked.

  8. Occurs only if an expression is configured for the Calculate file name option of the document type.

ClosedDocGenericEvent_AfterCreateReference 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.

ClosedDocGenericEvent_AfterDeleteReference 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 was called in the DocGenericEvent_BeforeDeleteReference event from PowerWeb, the reference was not be deleted.

ClosedDocGenericEvent_AfterEditRedlines 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.

ClosedDocGenericEvent_AfterReplaceContent 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.

ClosedDocGenericEvent_BeforeCreateReference 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.

ClosedDocGenericEvent_BeforeDeleteReference 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.

ClosedDocGenericEvent_BeforeEditRedlines 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.

ClosedDocGenericEvent_BeforeReplaceContent 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.

ClosedDocGenericEvent_BeforeSelectDocType 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_BeforeSelectDocumentType(Batch, DocTypeList)
Parameters
Name Description

Batch

An object that represents the action the user has selected.

DocTypeList

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.

ClosedDocGenericEvent_*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.

ClosedDocGenericEvent_*ChangeDocumentType Events

Occurs when a user changes the document type of documents.

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 BeforeChangeDocumentType procedure 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.

ClosedDocGenericEvent_*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

ClosedDocGenericEvent_DocumentFolderSelected 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 the Accruent Meridian Advanced Project Workflow Module Configuration Guide.

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.

ClosedDocGenericEvent_*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
Note:

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.

ClosedDocGenericEvent_OnProperties 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.

AS_PROP_CMD
constants
Constant Action PowerWeb PowerUser

AS_PS_CMD_VIEW

The user started viewing the property page.

A red x.

A green check mark.

AS_PS_CMD_EDIT

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

AS_PS_CMD_APPLY1

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

AS_PS_CMD_FINISH

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

AS_PS_CMD_CANCEL

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

A red x.

Note:

This 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.

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.

ClosedDocGenericEvent_*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.

ClosedDocGenericEvent_PrepareCommand 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.

ClosedDocGenericEvent_*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.

ClosedDocGenericEvent_*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 the AccruentMeridian Enterprise Configuration Guide.

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.

ClosedDocGenericEvent_*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.

ClosedDocGenericEvent_SelectTarget 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.

ClosedDocGenericEvent_*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 with the viewer. For information on configuring watermark printing with the Watermark properties, see Configure Watermark Printing.

Syntax

DraftPrint_SetWatermark

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

2021 R2