Req to Req Field Replication VBScript


I'm trying to auto-populate the Release field in Requirements when another requirement is linked (Traced To).  I am able to do this for 4 fields when a defect is linked to a req, but I can't figure it out when it is Req to Req.

  •  Here is my Req to Bug code

'Auto-populating 4 fields: Lead BA, Lead QA, Test Region & Linked Req ID from Requirements
Set td = TDConnection
Set bFact = td.BugFactory
Set bItem = bFact.Item(Bug_Fields.Field("BG_BUG_ID").Value)
Set bLinkFact = bItem.LinkFactory
Set bLinkList = bLinkFact.NewList("")
Set bLinkItem = bLinkList.Item(bLinkList.Count)
If bLinkItem.Field("LN_ENTITY_TYPE") = "Requirement" Then
Set rFact = td.ReqFactory
Set rItem = rFact.Item(bLinkItem.Field("LN_ENTITY_ID"))
bItem.Field("BG_USER_02") = rItem.Field("RQ_USER_15")          'Bug Lead BA FROM Req Lead BA
bItem.Field("BG_USER_16") = rItem.Field("RQ_USER_31")          'Bug Lead QA FROM Req Lead QA
bItem.Field("BG_USER_29") = rItem.Field("RQ_USER_52")          'Bug Test Region FROM REQ Test Region
bItem.Field("BG_USER_28") = rItem.Field("RQ_REQ_ID")           'Bug "Linked Req #" FROM Req ID

End If

Any experts have an answer on this?





  • 0  

    Please submit a support ticket to Micro Focus (OpenText) and we will assign an engineer to help.

  • 0  

    a req can linked to multiple releases.

    so req.Filed("RQ_TARGET_REL") returns a release list

    you'll need loop the list to get each release.

    to find other requirements linked to the release(s), you can use filter by release id(s) via ReqFactory's filter.

    Set td = TDConnection
    Set rFact = td.ReqFactory
    Set rItem = rFact.Item(Req_Fields.Field("RQ_REQ_ID").Value)

    set RelList = rItem.Field("REQ_TARGET_REL")

    FOR EACH rel in relList

    ' now here you can get all ids of the Releases


    ' then you can get other Reqs by filter the release id(s) from ReqFactory