Add R&D Comment to a defect in Quality Center with date and timestamp.
Question ID: 104052
2
0

Is there a way to Add an R&D comment to a defect with a date and timestamp, not just the date?

Marked as spam
Posted by (Questions: 4, Answers: 0)
Asked on February 24, 2010 4:52 pm
45 views
Answers (3)
2
Private answer

When adding an R&D comment to a defect, it would be beneficial to have the system also add a timestamp to the comments added. There is a documented HP KB article that provides a script that will add a timestamp, but it does not retain the original function (bolded blue text, line seperating each comment, etc.) This one does. Code provided with no warranties...

' BEGIN CODE
Function ActionCanExecute(ActionName)
On Error Resume Next
ActionCanExecute = DefaultRes


If ActionName=''AddDevComment'' or ActionName=''BugAddDevCommentsAction1'' then

    dim DescriptionBefore
    dim ServerTime
    dim UserStr


DescriptionBefore = Bug_Fields(''BG_DEV_COMMENTS'').Value

if Len(DescriptionBefore) = 0 then
        DescriptionBefore = ''<html><body>''
else
        DescriptionBefore = DescriptionBefore + ''<br><strong><font color=#000084>________________________________________<br></font></strong>''
end if

UserStr = User.FullName + '' &lt;'' + User.UserName + ''&gt; ''
ServerTime = CStr(TDConnection.ServerTime)


'Start R&D comments


    DescriptionBefore = DescriptionBefore + ''<strong><font color=#000084>''
    DescriptionBefore = DescriptionBefore + UserStr + '', ''
    DescriptionBefore = DescriptionBefore + ''''+ServerTime+''''
    DescriptionBefore = DescriptionBefore + ''</font></strong>'' + '': <font color=#000000>'' + ''<br>''


'End R&D Comments


    DescriptionBefore = DescriptionBefore + ''</font></body></html>''
    Bug_Fields(''BG_DEV_COMMENTS'').Value = DescriptionBefore

    ActionCanExecute = False


End If

On Error GoTo 0
End Function

' END CODE
Marked as spam
Posted by (Questions: 6, Answers: 167)
Answered on February 24, 2010 6:23 pm
1
Private answer

You can retain the formatting of existing Comments. Since the comments are embeded inside html Code, we need to retain the HTML code. Add the following Command after opening the QC connection:
''Connection_Name''.IgnoreHtmlFormat = False

Here connection_Name is the name of QC Connection Object. This statement will enforce the Connection to retain all HTML formatting...

Hopefully I will help....

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on May 28, 2010 2:13 am
0
Private answer

Hi,

This code is really helpful. but there is another question on it. after adding this code, comment gets added with username and timestamp but cursor goes to top of the textarea.
how can i set the cursor at the end of the comment area?

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on September 17, 2013 11:43 am
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top