HP ALM Workflow VBScript

This category will provide articles regarding usage of Visual Basic Script in the workflow module of HP ALM.

VBScript or HP ALM APIs do not offer a class or method for getting a file path from a user.

Therefore we have to use a workaround, which consists in using a different application to display a file picker dialog to a user.

A very simple solution would be to provide a user with an InputBox, which is unsatisfactory for me. Also users have to type or copy a path correctly, which they are sometimes not capable of.

I choose to automate Microsoft Excel to display a file picker dialog to a user.

The following source allows you to delete a file on a users hard disc without having to know if it really exists or not.

On top it provides you with error handling, so you only have to catch its Boolean result instead of having to check and handle these things every time.

Source Code

' @Author - Alexander Bolte
' @ChangeDate - 2014-12-19
' @Description - Using the Scripting API to delete a file,
' if it is existing under provided file path.
' @Returns ture, if file has been deleted or has not existed
' under given file path else false.
Function deleteFileOnHD(filePath)
    Dim fs ' As Scripting.FileSystemObject
    Dim ret ' As Boolean

    On Error Resume Next

    Set fs = createObject("Scripting.FileSystemObject")
    ' Check for a files existance.
    If fs.FileExists(filePath) Then
        ' delete a file.
        fs.DeleteFile(filePath)
    End If

    If Err.Number <> 0 Then
        Err.Clear
    Else
        ret = True
    End If
    Set fs = Nothing

    deleteFileOnHD = ret
End Function

Referenced API

Referenced APIs are as follows.

If you have to reference attachments in HP ALM Defects module the following script might give you a hint on how to implement it.

Source Code