How to prevent specifying an "ended" Release or Cycle in a Defect

  • KM03758791
  • 04-Nov-2020
  • 04-Nov-2020

Summary

In some cases it might be desirable to prevent selection of an expire Release or Cycle in Defect Target Release, Target Cycle.

Question

In some cases it might be desirable to prevent selection of an expire Release or Cycle in Defect Target Release, Target Cycle.

This can be solved through the use of workflow in ALM

Answer

Function Bug_FieldCanChange(FieldName, NewValue)
  If FieldName = "BG_DETECTED_IN_REL" Then
     If RetrieveTR(NewValue) = True Then  'pass the name of the release
        Bug_FieldCanChange = DefaultRes
     Else
        msgbox "Release End Date has passed" & vbcrlf & vbcrlf & "Select a valid Release"
        Bug_FieldCanChange = False
     End If
  ElseIf FieldName = "BG_DETECTED_IN_RCYC" Then
     If RetrieveTC(NewValue) = True Then  'pass the name of the release
        Bug_FieldCanChange = DefaultRes
     Else
        msgbox "ReleaseCycle End Date has passed" & vbcrlf & vbcrlf & "Select a valid ReleaseCycle"
        Bug_FieldCanChange = False
     End If
  Else
     Bug_FieldCanChange = DefaultRes
  End If
End Function

Function RetrieveTR(RelName)
     Set relFactory = TDConnection.ReleaseFactory
     set RelFilter=   relFactory.filter
     RelFilter.filter("REL_NAME")="""" & RelName & """"
     Set listOfReleases = RelFilter.NewList
     Set ReleaseItem= listOfReleases.item(1)
     If ReleaseItem.DaysLeft > 0 Then
        bolAllowed = True
     Else
        bolAllowed = False
     End If
     RetrieveTR=bolAllowed
End Function

Function RetrieveTC(CycleName)
      Set cycFactory =TDConnection.CycleFactory
      Set cycFilter = cycFactory.Filter
      CycFilter.Filter("RCYC_NAME" ) = """" & CycleName & """"
      Set listOfCycles = CycFilter.NewList
      Set CycleItem= listOfCycles.item(1)
      If CycleItem.DaysLeft > 0 Then
        bolAllowed = True
     Else
        bolAllowed = False
     End If
     RetrieveTC=bolAllowed
End Function