Hi
I am trying to set target cycle to requirement using OTA. Below code runs without any issues but the value is not set to target cycle field after the run. Even if some other value exists in record, it overwrites that and sets to null. Data conditions are matched and I can see valid cycle passed back to main function in object variables but something is not correct after that. Can someone please help what I did wrong here?
***Main code that calls the funtion to return the matching cycle and set the returned cycle list to new requirement field*****
Dim CycleID As Cycle
Set CycleID = FindCycles(ReleaseID.Item(1).ID, CRSprint)
newR.Field("RQ_TARGET_RCYC") = CycleID
*****Function that searches for cycle with matching conditions**************
Public Function FindCycles(ReleaseID As Long, CRSprint As String) As Cycle
'Get the release cycles that match the filter.
Dim aFilter, rFilter As TDFilter
Dim listOfCycles, RelList As List
Dim cyc As Cycle
Dim cycFactory As CycleFactory
Set cycFactory = QCConnection.CycleFactory
Set aFilter = cycFactory.Filter
aFilter.Filter("RCYC_PARENT_ID") = ReleaseID
' Get the list of matching release cycles.
Set listOfCycles = aFilter.NewList
For Each cyc In listOfCycles
If Trim(cyc.Name) = Trim(CRSprint) Then
Set FindCycles = cyc
GoTo ClearSet
End If
Next
Set FindCycles = Nothing
ClearSet:
Set aFilter = Nothing
Set listOfCycles = Nothing
Set cyc = Nothing
Set cycFactory = Nothing
Exit Function
End Function