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

AIMS_Attach_After event

Occurs after a user has invoked the Upload command in Meridian Explorer and:

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.

Function AIMS_Attach_After (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 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)
    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
    AIMS_GetQueryStringValue = ""
End Function

Related information

AIMS_Attach_Intialize event

AIMS_Attach_Before event

AIMS_AddComment event

AIMS_CloseComment event

AIMS_DeleteComment event

AIMS_UpdateComment event