Document Generic Events
These are events that do not fall under any of the other document event categories.
Document Generic Event Sequences
The events that occur for the document generic commands are shown in the following lists in the sequence that they occur.
Change Document Type event sequence
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_PreInitializeChangeDocumentType
-
DocGenericEvent_InitializeChangeDocumentType
-
DocGenericEvent_PreBeforeChangeDocumentType
-
DocGenericEvent_BeforeChangeDocumentType
-
DocGenericEvent_AfterChangeDocumentType
-
DocGenericEvent_BeforeNewDocument
-
DocGenericEvent_OnProperties
-
DocGenericEvent_AfterNewDocument
-
DocGenericEvent_TerminateChangeDocumentType
Delete event sequence
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializeDelete
-
DocGenericEvent_BeforeDelete
-
DocGenericEvent_AfterDelete
-
DocGenericEvent_TerminateDelete
Draft Print event sequence
Does not occur in PowerWeb.
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializePrint
-
DocGenericEvent_BeforePrint
-
DocGenericEvent_AfterPrint
-
DocGenericEvent_TerminatePrint
Issue New Filename event sequence
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializeCalculateFileName
-
DocGenericEvent_TerminateCalculateFileName
New Document event sequence
Does not occur when new documents are created by the Database Import Wizard in Configurator.
-
DocGenericEvent_BeforeSelectDocumentType
-
The following two events DO NOT occur when new documents are created by the Document Import tool in PowerUser:
-
DocGenericEvent_InitializeNewDocument
-
DocGenericEvent_InitializeCalculateFileName
-
-
DocGenericEvent_SelectTarget
-
DocGenericEvent_BeforeNewDocument
-
The following four events occur ONLY if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = False and Document.ParentFolder is not a valid folder:
-
ProjectWorkflowEvent_PrepareBrowser
-
ProjectWorkflowEvent_InitializeExpandItem
-
ProjectWorkflowEvent_BeforeExpandItem
-
DocGenericEvent_DocumentFolderSelected
-
-
DocGenericEvent_OnProperties: Does not occur when new documents are created by the Document Import tool in PowerUser.
-
The following four events occur ONLY if Client.Confirmation (AS_CONFIRM_NO_SELECTPROJECTWIZARD) = True and Document.ParentFolder is not a valid folder.
-
ProjectWorkflowEvent_PrepareBrowser
-
ProjectWorkflowEvent_InitializeExpandItem
-
ProjectWorkflowEvent_BeforeExpandItem
-
DocGenericEvent_DocumentFolderSelected
-
-
DocGenericEvent_AfterNewDocument
-
The following two events occur ONLY if an expression is configured for the Calculate file name option of the document type:
-
DocGenericEvent_BeforeCalculateFileName
-
DocGenericEvent_AfterCalculateFileName
-
-
The following two events DO NOT occur when new documents are created by the Document Import tool in PowerUser:
-
DocGenericEvent_TerminateCalculateFileName
-
DocGenericEvent_TerminateNewDocument
-
Open in Application event sequence
Occurs in PowerWeb when documents are downloaded.
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializeOpenInApplication
-
DocGenericEvent_BeforeOpenInApplication
-
DocGenericEvent_AfterOpenInApplication
-
DocGenericEvent_TerminateOpenInApplication
Prepare for Offline Work event sequence
Does not occur in PowerWeb.
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializePrepareForOffline
-
DocGenericEvent_BeforePrepareForOffline
-
DocGenericEvent_AfterPrepareForOffline
-
DocGenericEvent_TerminatePrepareForOffline
Redline event sequence
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_BeforeEditRedlines: Does not occur in PowerWeb.
-
DocGenericEvent_AfterEditRedlines
Refresh Thumbnail event sequence
Does not occur in PowerWeb.
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializeUpdateThumbnail: Does not occur if the Refresh thumbnail button on the Document page is clicked.
-
DocGenericEvent_BeforeUpdateThumbnail
-
DocGenericEvent_AfterUpdateThumbnail
-
DocGenericEvent_TerminateUpdateThumbnail: Does not occur if the Refresh thumbnail button on the Document page is clicked.
Rename event sequence
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_InitializeRename
-
DocGenericEvent_BeforeRename
-
DocGenericEvent_AfterRename
-
DocGenericEvent_TerminateRename
Replace Content event sequence
Does not occur in PowerWeb.
-
DocGenericEvent_PrepareCommand
-
DocGenericEvent_BeforeReplaceContent
-
DocGenericEvent_AfterReplaceContent
AfterCreateReference Event
Occurs after a reference between documents has been manually created by a user.
Syntax
DocGenericEvent_AfterCreateReference(Batch, RefType, TargetDocument, [RefDisplayName])
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. |
AfterDeleteReference Event
Occurs after a reference between documents has been manually deleted by a user.
Syntax
DocGenericEvent_AfterDeleteReference(Batch, RefType, TargetDocument, [RefDisplayName])
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.
AfterEditRedlines Event
Occurs after documents are redlined by a user with the Meridian viewer.
Syntax
DocGenericEvent_AfterEditRedlines(Batch)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
AfterReplaceContent Event
Occurs after a user replaces the content of documents.
Syntax
DocGenericEvent_AfterReplaceContent(Batch, SourceFile)
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. |
BeforeCreateReference Event
Occurs before a reference between documents is manually created by a user.
Syntax
DocGenericEvent_BeforeCreateReference(Batch, RefType, TargetDocument, [RefDisplayName])
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. |
BeforeDeleteReference Event
Occurs before a reference between documents is manually deleted by a user.
Syntax
DocGenericEvent_BeforeDeleteReference(Batch, RefType, TargetDocument, [RefDisplayName])
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.
BeforeEditRedlines Event
Occurs before documents are redlined by a user with the Meridian viewer.
Syntax
DocGenericEvent_BeforeEditRedlines(Batch)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
BeforeReplaceContent Event
Occurs before a user replaces the content of documents.
Syntax
DocGenericEvent_BeforeReplaceContent(Batch, SourceFile)
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.
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_BeforeReplaceContent(Batch, DocTypesList)
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.
*CalculateFilename Events
Occurs when the filename of a document is calculated by its document type.
Syntax
DocGenericEvent_*CalculateFilename(Batch)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
*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)
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.
*Delete Events
Occurs when documents or folders are deleted by a user.
Syntax
DocGenericEvent_*Delete(Batch)
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
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 Project Workflow Events.
Syntax
DocGenericEvent_DocumentFolderSelected (Batch, SelectedFolder)
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.
*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)
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.
OnProperties Event
Occurs when a user views or edits the property pages of a document or folder.
Syntax
DocGenericEvent_OnProperties(Command, Abort)
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.
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.
*OpenInApplication Events
Occurs when documents are opened by a user in their native application.
Syntax
DocGenericEvent_*OpenInApplication(Batch, AppName)
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. |
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)
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.
*PrepareForOffline Events
Occurs when a user prepares documents for offline mode operation.
Syntax
DocGenericEvent_*PrepareForOffline(Batch)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
*Print Events
Occurs when documents are printed by a user from Meridian with the viewer.
Syntax
DocGenericEvent_*Print(Batch)
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.
*Rename Events
Occurs when documents or folders are renamed by a user.
Syntax
DocGenericEvent_*Rename(Batch, NewName)
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. |
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)
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.
*UpdateThumbnail Events
Occurs when a user updates the thumbnail images of documents manually.
Syntax
DocGenericEvent_*UpdateThumbnail(Batch)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
DraftPrint_SetWatermark Event
Occurs when documents are printed by a user from Meridian Explorer or PowerWeb with the viewer.
Support for PowerWeb was added in the 2022 release.
Syntax
DraftPrint_SetWatermark
Remarks