| || |
Customization of Closing Date
Iam new to this script editor in quality center i wanted to customize the closing date field automatically once defect status is changed to closed.I wrote the below script can anyone suggest me what is the wrong in my script.
if Bug_fields("BG_STATUS").IsModified="Closed" then
Re: Customization of Closing Date
First of all, you just do not need to set the closing date when the bug status is set to "Closed" : this is done automatically at the server.
Now, as for your code, I can see 3 problems, but there may be more :
1. Wrong place. The procedure that you use to set the closing date is not the right one. Using Bug_CanPost would probably more adequate. You need to understand what subs/functions are called in the workflow in conjunction with user's actions. Refer to the admin guide and/or use DebugView.
2. Wrong test. The IsModified property is a boolean and cannot be equal to the value of the field. You probably need to test that IsModified is True and that Value is "Closed". Refer to the admin guide where are explained the properties and methods of the objects you can manipulate in the workflow. Have a look at the workflow examples to get a better understanding.
3. Wrong value. Using the Date value would set the closing date according to the client's calendar, whereas all dates in the database are set according to the DB server calendar. You'd better use the TDConnection.ServerTime.
But, as I said, it's not worth correcting all these errors as the closing date is updated by QC for you.