Asset Management Events
Asset management events occur when users work with the commands provided by the Meridian Enterprise Asset Management module.
AIMS_AddComment Event
Occurs after a user has added a comment to a document in Meridian Explorer.
Syntax
Function AIMS_AddComment (commentText As String, attachmentType As String, numberOfComments As Long)
Name | Description |
---|---|
commentText |
The text of the comment. |
attachmentType |
The type of file attached to the comment. The possible values are: 0: No attachment 1: Redline 2: Image |
numberOfComments |
The total number of comments on the document. |
Example
Function AIMS_AddComment(commentText, attachmentType, numberOfComments) Document.Log "A comment was added to " + Document.FileName + vbNewLine + "Text: " + commentText Select Case attachmentType Case "Redline" Document.Log "A redline markup was added to " + Document.FileName Case "File" Document.Log "A file was attached to " + Document.FileName End Select End Function
AIMS_Attach_Intialize Event
Occurs after a user has invoked the Upload command in Meridian Explorer to upload a file but before the document is created in the vault. This event can be used to get the source filename and the URL parameters of the Meridian Explorer page. Its return values can be used to allow the upload to proceed and to specify the destination folder and document type or to cancel the operation.
This event is required for the Upload command.
Syntax
Function AIMS_Attach_Intialize (SourceFilename As String, QueryString As Array) As Array
Name | Description |
---|---|
SourceFilename |
The original filename that is uploaded from the client. |
QueryString |
An array of name-value pairs for the URL parameters of the Meridian Explorer page. |
Value | Description |
---|---|
Result |
Boolean True if the event should succeed, False if it should fail. If the event should fail, the upload is aborted and an error message should be returned as the second item in the array and the following items should not be returned. |
TargetPath |
The path of the target folder in the vault where the uploaded file should be stored. |
DocumentType |
The internal name of the document type that should be assigned to the new document. |
Example
' Event handler for BC-Explorer Asset Management Module link
' Returns required input for the Upload function
Function AIMS_Attach_Intialize(sourceFileName, queryString)
Dim targetFolder
Dim docTypeName
' Determine the target folder for the uploaded document
Set targetFolder = Vault.RootFolder.GetSubFolder("Miscellaneous")
If Not User.HasPrivilege(AS_PRIVILEGE_DOCUMENT_CREATE, targetFolder) Then
' Abort the upload
AIMS_Attach_Intialize = Array(False, "Upload is not allowed")
Exit Function
End If
' Determine the document type for the uploaded folder
docTypeName = "GenericDocument"
If (LCase(Right(sourceFileName, 4)) = ".dwg") Then
docTypeName = "Drawing"
End If
' Return an array with the target folder path and the document type name
AIMS_Attach_Intialize = Array(True, targetFolder.Path, docTypeName)
End Function
AIMS_Attach_Before Event
Occurs after a user has invoked the Upload command in Meridian Explorer to upload a file and the document object has been created in the vault. It occurs before the document content has been imported, its properties have been set, and the reference created. This event can be used to set the properties and workflow state of the Document object. Its return values can be used to allow the operation to proceed or to cancel the operation. This event is optional for the Upload command.
Syntax
Function AIMS_Attach_Before (SourceFilename As String, QueryString As Array) As Array
Name | Description |
---|---|
SourceFilename |
The original filename that is uploaded from the client. |
QueryString |
An array of name-value pairs for the URL parameters of the Meridian Explorer page. |
Value | Description |
---|---|
Result |
Boolean True if the event should succeed, False if it should fail. If the event should fail, the document creation is aborted and an error message should be returned as the second item in the array. |
Message |
An error message to show the user why the operation has been aborted. |
Example
' Event handler for BC-Explorer Asset Management Module link ' Invoked before the uploaded content is imported to the document Function AIMS_Attach_Before(sourceFileName, queryString) Dim viewID Dim tagFilter Dim tagnr ' You may retrieve values from the URL of the BC-Explorer Related Documents page viewID = AIMS_GetQueryStringValue(queryString, "VIEWID") tagFilter = AIMS_GetQueryStringValue(queryString, "TAGFILTER") tagnr = AIMS_GetQueryStringValue(queryString, "TAGNR") If False Then ' You may abort the upload if required AIMS_Attach_Before = Array(False, "Some reason to stop the upload") Exit Function End If AIMS_Attach_Before = Array(True, "") End Function ' Extract the value from the name-value collection Function AIMS_GetQueryStringValue(queryString, name Dim index For index = LBound(queryString, 1) To UBound(queryString, 1) ' Find the named value If (UCase(Cstr(QueryString(index)(0))) = UCase(CStr(name))) Then ' Return the value AIMS_GetQueryStringValue = Cstr(QueryString(index)(1)) Exit Function End If Next AIMS_GetQueryStringValue = "" End Function
Remarks
The first source vault of the repository is used as the destination. If a document with the same name already exists in the vault, a number will be appended to the name, for example, MyFile(1).
AIMS_Attach_After Event
Occurs after a user has invoked the Upload command in Meridian Explorer and:
-
The document tag has been created in the vault
-
Its content has been imported
-
Its properties have been set
-
The reference to the Meridian Explorer item as been created
-
But before the transaction has been committed.
This event can be used to modify the Document object and to allow the operation to complete or to cancel the operation. This event is optional for the Upload command.
Syntax
Function AIMS_Attach_After (SourceFilename As String, QueryString As Array) As Array
Name | Description |
---|---|
SourceFilename |
The original filename that is uploaded from the client. |
QueryString |
An array of name-value pairs for the URL parameters of the Meridian Explorer page. |
Value | Description |
---|---|
Result |
Boolean True if the event should succeed, False if it should fail. If the event should fail, the document creation is aborted and an error message should be returned as the second item in the array. |
Message |
An error message to show the user why the operation has been aborted. |
Example
' Event handler for BC-Explorer Asset Management Module link ' Invoked after the uploaded content is imported to the document Function AIMS_Attach_After(sourceFileName, queryString) Dim viewID Dim tagFilter Dim tagnr ' You may retrieve values from the URL of the BC-Explorer Related Documents page viewID = AIMS_GetQueryStringValue(queryString, "VIEWID") tagFilter = AIMS_GetQueryStringValue(queryString, "TAGFILTER") tagnr = AIMS_GetQueryStringValue(queryString, "TAGNR") ' Create a reference to the asset Dim doc Dim criteria criteria = Array(Array("TagInfo.TagNr", IC_OP_EQUALS, tagnr)) For Each doc In Vault.FindDocuments(, Array("TagObject"), criteria, False) Document.GetReferences("TagObjectReference",False).Add(doc.ID) Next If False Then ' You may abort the upload if required AIMS_Attach_After = Array(False, "Some reason to stop the upload") Exit Function End If ' Release the uploaded document Call Document.ChangeWorkflowState(AS_WF_RELEASED, "", User.Name) Document.Log User.Name + " uploaded '" + sourceFileName + "' to " + Document.Path ' Return a user message AIMS_Attach_After = Array(True, "Upload completed") End Function ' Extract the value from the name-value collection Function AIMS_GetQueryStringValue(queryString, name Dim index For index = LBound(queryString, 1) To UBound(queryString, 1) ' Find the named value If (UCase(Cstr(QueryString(index)(0))) = UCase(CStr(name))) Then ' Return the value AIMS_GetQueryStringValue = Cstr(QueryString(index)(1)) Exit Function End If Next AIMS_GetQueryStringValue = "" End Function
AIMS_DeleteComment Event
Occurs after a user has deleted a comment from a document in Meridian Explorer.
Syntax
Function AIMS_DeleteComment (commentText As String, attachmentType As String, numberOfComments As Long)
Name | Description |
---|---|
commentText |
The text of the comment. |
attachmentType |
The type of file attached to the comment. The possible values are: 0: No attachment 1: Redline 2: Image |
numberOfComments |
The total number of comments on the document. |
Example
Function AIMS_DeleteComment(commentText, attachmentType, numberOfComments) If numberOfComments = 0 Then Document.Log "All comments have been removed from " + Document.FileName + vbNewLine + "Text: " + commentText Else Document.Log "A comment was removed from " + Document.FileName + vbNewLine + "Text: " + commentText End If End Function
AIMS_CloseComment Event
Occurs after a user has closed a discussion on a document in Meridian Explorer.
Syntax
Function AIMS_CloseComment (commentText As String, attachmentType As String, numberOfComments As Long)
Name | Description |
---|---|
commentText |
The text of the comment. |
attachmentType |
The type of file attached to the comment. The possible values are: 0: No attachment 1: Redline 2: Image |
numberOfComments |
The total number of comments on the document. |
Example
Function AIMS_CloseComment(commentText, attachmentType, numberOfComments) Document.Log "A comment was closed for " + Document.FileName + vbNewLine + "Text: " + commentText End Function
AIMS_UpdateComment Event
Occurs after a user has updated a comment on a document in Meridian Explorer.
Syntax
Function AIMS_UpdateComment (commentText As String, attachmentType As String, numberOfComments As Long)
Name | Description |
---|---|
commentText |
The text of the comment. |
attachmentType |
The type of file attached to the comment. The possible values are: 0: No attachment 1: Redline 2: Image |
numberOfComments |
The total number of comments on the document. |
Example
Function AIMS_UpdateComment(commentText, attachmentType, numberOfComments) Document.Log "A comment was updated for " + Document.FileName + vbNewLine + "Text: " + commentText Select Case attachmentType Case "Redline" Document.Log "A redline markup was added to " + Document.FileName Case "File" Document.Log "A file was attached to " + Document.FileName End Select End Function
ObjectsPage_IsVisible Event
Occurs before the Objects HTML page is shown in PowerWeb.
Syntax
ObjectsPage_IsVisible As Boolean
Remarks
The Objects HTML page is an alternative implementation of the default Objects page that is shown in PowerUser. The HTML page has equivalent functionality that is not available in the default page shown by the AssetManagementTags extension in PowerWeb. The HTML page is only for use in PowerWeb and the AssetManagementTags extension should not be assigned to any document types.
Return False (default) to hide the property page.
Example
Function ObjectsPage_IsVisible() ObjectsPage_IsVisible = True End Function
WhereUsedPage_IsVisible Event
Occurs before the Where Used HTML page is shown in PowerWeb.
Syntax
WhereUsedPage_IsVisible As Boolean
Remarks
The Where Used HTML page is an alternative implementation of the default Where Used page that is shown in PowerUser. The HTML page has equivalent functionality that is not available in the default page shown by the AssetManagementWhereUsed extension in PowerWeb. The HTML page is only for use in PowerWeb and the AssetManagementWhereUsed extension should not be assigned to any document types.
Return False (default) to hide the property page.
Example
Function WhereUsedPage_IsVisible() WhereUsedPage_IsVisible = True End Function