ALM workflow code to stop editing of previous comments in defects?
Question ID: 104811
0
0

Does anyone have any workflow code that could be used to make it so that testers could not edit or delete previous users R&D defect comments?

Marked as spam
Posted by (Questions: 98, Answers: 0)
Asked on January 24, 2013 3:16 pm
284 views
Answers (2)
1
Private answer

Hello,

Yes this is possible, the best way to do this would be by using two fields, in this example, a new memo field in the defects module will need to be created. In this example this new defect memo field will be called ''BG_USER_25''. The other field that this code deals with is the ''BG_DEV_COMMENTS'' which is the regular defects comment field. All new comments will need to be added using the new memo field that you create, then a user stamp and date/time stamp is added and combined with the existing comments. After the new comment is added to the existing comments, the new comment memo field is cleared. The users will need to learn that to add new defect comments that they are added from the ''New Comment'' memo field and not the regular comment field.

Note: Please test this code on a test project before implementing on a large scale, since all projects in QC are different unexpected results could occur.

Add the following to the Bug_fieldchange and bug_moveto subroutines, replacing the ''BG_USER_25'' with the new memo field that you created for entering the new comments.

Sub Bug_FieldChange(FieldName)
On Error Resume Next

if Bug_Fields.Field(''BG_User_25'').IsModified=true then
NewComment = ''
'' & user.UserName & '''' & date() & '''' & time() & '':'' & Bug_Fields.Field(''BG_User_25'').Value
PreviousComment = Bug_Fields.field(''BG_DEV_COMMENTS'').value
CombinedComment = PreviousComment + NewComment
Bug_Fields.Field(''BG_DEV_COMMENTS'').IsReadOnly = False
Bug_Fields.Field(''BG_DEV_COMMENTS'').value = CombinedComment
Bug_Fields.Field(''BG_DEV_COMMENTS'').IsReadOnly = True
Bug_Fields.Field(''BG_User_25'').value = ''''
End If

On Error GoTo 0
End Sub

Sub Bug_MoveTo
On Error Resume Next

Bug_Fields.Field(''BG_DEV_COMMENTS'').IsReadOnly = True

On Error GoTo 0
End Sub

Marked as spam
Posted by (Questions: 0, Answers: 364)
Answered on January 24, 2013 3:19 pm
0
Wow, this works great. Thanks
( at January 28, 2013 8:13 pm)
0
Private answer

While this works as described i have noticed that the comments from the new memo field bg_user_25 come into the comments field ''bg_dev_comments'' as plain text with html tags embedded as opposed to making the comment HTML (not plain text) which would remove the html tags. This is happening regardless of making bg_user_25 field as text or html format. Another thing is how does one delete an unwanted comment? Thanks

Marked as spam
Posted by (Questions: 19, Answers: 17)
Answered on November 21, 2018 12:15 am
EyeOnTesting

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

X
Scroll to Top