You are here: Appendix D: VBScript reference > The Meridian Enterprise events > AIMS_Attach_Before event

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.

Function AIMS_Attach_Before (SourceFilename As String, QueryString As Array) As Array




The original filename that is uploaded from the client.


An array of name-value pairs for the URL parameters of the Meridian Explorer page.
Returned array
Value Description


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.


An error message to show the user why the operation has been aborted.

' 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
    AIMS_GetQueryStringValue = ""
End Function

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

Related information

AIMS_Attach_Intialize event

AIMS_Attach_After event

AIMS_AddComment event

AIMS_CloseComment event

AIMS_DeleteComment event

AIMS_UpdateComment event