HimanshuJain Absent Member.
Absent Member.

Autoupdate Closing Date in Defect tab,once done,field cant be updated & remains read-only henceforth



I want to make the Closing Date field under Defect Management tab in QC as auto field, which takes up date value once status is changed to Closed. Once modified/updated it should become read-only and no one should be able to edit it.

Also if a closed defect is browsed and opened again(just for taking reference not for updating any previous info.) , field should be display its closing date value should be visible as read only field.

Also field should only get visible when status is closed, for all other status it should be hidden.


I came up with some solution:


Sub Bug_MoveTo()
Defect_Details()                                                                                       'This displays defect description screen

 Bug_Fields.Field("BG_CLOSING_DATE").IsReadOnly = True      'To keep the field as read only

                                                                                                                     'when opening a defect.

End Sub


Sub Defect_Status()

Select case Bug_Fields("BG_STATUS").value
case "Closed"

        Bug_Fields.Field("BG_CLOSING_DATE").IsReadOnly = False              ' To allow it accept Date value
        Bug_Fields.Field("BG_CLOSING_DATE").Value = Date

        Bug_Fields.Field("BG_CLOSING_DATE").IsVisible = True  

        Bug_Fields.Field("BG_CLOSING_DATE").IsReadOnly = TRUE

case "New"

        Bug_Fields.Field("BG_CLOSING_DATE").IsVisible = False
End Sub



But still I am unable to keep the closing field as hidden for other status. Also while opening any closed defect closing date field is editable.


Please try to help me with this guys!!!

Tnx in advance. 🙂

1 Reply
Outstanding Contributor.. Venkat457 Outstanding Contributor..
Outstanding Contributor..

Re: Autoupdate Closing Date in Defect tab,once done,field cant be updated & remains read-only he



I didnt see an else opened in your code below.You should be using an else when you are going by case.


To my understanding ,here is what you are looking for


Closing date field should only be visible when status is closed but be read-only,in rest cases it shouldn't display and be read-only as well(if you put it to invisible,then no need to think of read-only).I would do below


In workflow level in Subset Fields layout where you arrange your fields layout ,



Bug_Fields.Field("BG_CLOSING_DATE").Isreadonly = True


This will make field readonly in all states.


Next to make this visble in closed status only,


Put below code in Sub Bug_Move to


If (Bug_Fields.Field("BG_STATUS").Value = "Closed") Then
     SetFieldApp "BG_CLOSING_DATE", True, False,        ---This true will make field as visible

     SetFieldApp "BG_CLOSING_DATE", False, False, 0,28     -----This will make field as invisible in all states

End If       


If not you  can use below


If  (Bug_Fields.Field("BG_STATUS").Value <> "Closed") Then
         Bug_Fields("BG_CLOSING_DATE").IsVisible = False


        Bug_Fields("BG_CLOSING_DATE").IsVisible = True

 End If






The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.