I want TD8.0 to automatically select Close Date as current date when a defect status is changed to "Rejected" or "Closed". I have written below code in Defects_Bug_FieldChange method. Code works fine and select date on status change but when i refresh TD or open defect again, close date is removed and also i cannot enter it manually. Looks like some script runs when i refresh TD. I could not find any routine doing this task in Defect Module Script. Any thoughts why its happening?



If FieldName = "BG_STATUS" and (Bug_Fields.Field("BG_STATUS").Value = "Closed" or Bug_Fields.Field("BG_STATUS").Value = "Tool Limitation" or Bug_Fields.Field("BG_STATUS").Value = "Rejected") Then
Bug_Fields.Field("BG_CLOSING_DATE").Value = Date

Bug_Fields.Field("BG_CLOSING_DATE").Value = ""
End if