Quantcast
Viewing all articles
Browse latest Browse all 14708

Import of requirements gives unexpected error

Hi

 

I'm creating an Excel macro to upload requirements to ALM 11.00, but I run into unexpected behaviour.

 

When I upload an requirment the first time, it works as expected and the requirement is created perfectly.

After the upload, I move the newly created requirement manually to another folder. Next, I run the same code, on the same data and then I get the following error: "Duplicate requirement name ('reqName') was given by the user. The requirement wasn't created"

 

This seems very strange to me, because there is no requirement with that name in the folder, so it should be possible to create it.  Even more, if I try to create that requirement manually in ALM, it works and I don't get an error.

 

Can anyone help me out?

 

Thanks in advance

 

Public Function uploadRequirement(TdConnection, reqPath, reqName, reqType, reqAuthor, Optional reqPriority)

    parentID = getIdOfRequirement(TdConnection, reqPath) ''Returns the ID of the parent folder/requirement       
       
    Set reqFact = TdConnection.ReqFactory
    Set req = reqFact.AddItem(Null)
    req.parentID = parentID
    req.TypeId = reqType
    req.name = reqName
    req.Author = reqAuthor
    
    If Not IsMissing(reqPriority) Then
        req.priority = reqPriority
    End If
    
    req.Post
    req.UnlockObject
        

    uploadRequirement = req.ID
End Function

Function getIdOfRequirement(tdc, parentReqPath)

    Dim result
    result = -1
    Set reqFact = tdc.ReqFactory
    Set reqList = reqFact.NewList("")
    For i = 1 To reqList.Count
        If reqList(i).path = parentReqPath Then
            result = reqList(i).ID
            Exit For
        End If
    Next

    getIdOfRequirement = result
    
End Function

 

 

 

 


Viewing all articles
Browse latest Browse all 14708

Trending Articles