I searched and searched a lot and couldn't find my answer. I want to see that a parent record in ClearQuest should not get closed before all of its child records aren't closed. Below is the code that I am upto now., but failing to meet the objective. Help me please?
set sessionObj = GetSession
CRdbid = GetFieldValue("dbid").GetValue()
Set entity = sessionObj.GetEntity("CR", CRdbid)
a = entity.GetFieldValue("CR_ID").GetValue()
set querydef = sessionObj.BuildQuery("CR_Child")
querydef.buildfield ("dbid")
querydef.buildfield("ChildCR_ID")
querydef.buildfield("state")
set operator = querydef.BuildFilterOperator(AD_BOOL_OP_AND)
operator.BuildFilter "ChildCR_ID", AD_COMP_OP_LIKE, "a"
operator.BuildFilter "state", AD_COMP_OP_NEQ, "CLOSED"
set resultset = sessionObj.BuildResultSet(querydef)
resultset.execute
if resultset.MoveNext = AD_SUCCESS then
CR_Validation = "Close the child CR's"
End If