Search code examples
vbscriptscriptinghp-quality-center

How to read the user email address in HP QC Script Editor?


Inside the HP Quality Center Scripting Editor, I can access current user info (like user name or full name) with the "user" object.

How do I access the current user E-Mail address property?


Solution

  • From what I can see in QC workflow documentation, the user object only had these properties: FullName, IsInGorup and UserName.

    Since this is the case, you need access to the full user data, which you can get by using the customization metadata exposed by OTA.

    To get user info, you need to get the CustomizationUser object which has an Email property. Here is a sample from documentation on iterating over the users list:

    Sub ListUsers()
    
      Dim custUsers As CustomizationUsers
      Dim USR As CustomizationUser
      Dim UList As List
    
      Set custUsers = tdc.Customization.Users
    
      Set UList = custUsers.Users
      Debug.Print UList.Count
    
      Dim maxU%, uCnt%
    
      maxU = 5
    
      For Each USR In UList
        uCnt = uCnt + 1
        With USR
            Debug.Print .name & ", " & .Email
        End With
        If uCnt > maxU Then Exit For
      Next USR
    
    Exit Sub
    ErrorHandler:
        ErrHandler err
    End Sub