Nani1 Frequent Contributor.
Frequent Contributor.
435 views

When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

We have customized in workflow that user should add comments in Test plan (Test case) , problem am facing is when i add comments in a test case (Test Plan module) then automatically and blank comment is getting added to the selected defect in defect module. Is there anyway if add comment in test case, defect is not updated. Sorry am new to alm admin and workflows. TIA 

0 Likes
1 Solution

Accepted Solutions
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

If ActiveModule = "Test Plan" and ActionName="BugAddDevCommentsAction1"  Then...

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
9 Replies
Nani1 Frequent Contributor.
Frequent Contributor.

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

Action name  BUGAddDevcommentsAction1 is for all modules. Or this is action is only for defects module?

if so then for tes plan adding comments, can anyone let me know the action name

0 Likes
Valued Contributor.. Ankit Ranka Valued Contributor..
Valued Contributor..

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution
I think the action is same for all modules but may I know what code you are
using exactly and in which function you are putting it?
If possible please paste the code so that I can try to help.

Regards,
Ankit
0 Likes
Nani1 Frequent Contributor.
Frequent Contributor.

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

I am putting in Template_ActionCanExecute . Please find the code i used.

 

Dim oDicUser, Run_Parameter, Run_test_Id
Function Template_ActionCanExecute(ActionName)
On Error Resume Next

'Msgbox ActionName

Template_ActionCanExecute = DefaultRes


'-----------------------Start latest comments at the top ---------------------------------------------------------------------------------------------------------------------
If ActionName="BugAddDevCommentsAction1" Then
dim DescriptionBefore
dim ServerTime
dim UserStr

DescriptionBefore = Bug_Fields("BG_DEV_COMMENTS").Value

'remove html tags
If Len(DescriptionBefore) <> 0 then
DescriptionBefore = Replace(DescriptionBefore, "<html><body>", "")
DescriptionBefore = Replace(DescriptionBefore, "</body></html>", "")
end if

UserStr = User.FullName
If Trim(UserStr) = "" then
UserStr = User.UserName
Else
'concatenate user's full name with username
UserStr = UserStr + " &lt;" + User.UserName + "&gt;"
End if

ServerTime = CStr(TDConnection.ServerTime)
'strInput = inputBox ("Enter Comment for change")
DescriptionBefore = "" + UserStr + ", " + ServerTime + ": " + "" & strInput & "

________________________________________
" + DescriptionBefore + ""
Bug_Fields("BG_DEV_COMMENTS").Value = DescriptionBefore
'Bug_Fields("BG_USER_25").Value = "" + UserStr + ", " + ServerTime + ": " + "" & strInput & "

"
Template_ActionCanExecute = False
End If
'**************************************************************************************Requirement module***********************************************************

-----------------------Start latest comments at the top ---------------------------------------------------------------------------------------------------------------------
'If ActionName="BugAddDevCommentsAction1" Then
' dim DescriptionBefore1
' dim ServerTime1
'dim UserStr1

' DescriptionBefore1 = Req_Fields("RQ_DEV_COMMENTS").Value

'remove html tags
' If Len(DescriptionBefore1) <> 0 then
'DescriptionBefore1 = Replace(DescriptionBefore1, "<html><body>", "")
' DescriptionBefore1 = Replace(DescriptionBefore1, "</body></html>", "")
' end if

'UserStr1 = User.FullName
' If Trim(UserStr) = "" then
'UserStr1 = User.UserName
' Else
'concatenate user's full name with username
' UserStr1 = UserStr1 + " &lt;" + User.UserName + "&gt;"
' End if

'ServerTime1 = CStr(TDConnection.ServerTime)
'strInput = inputBox ("Enter Comment for change")
' DescriptionBefore1 = "" + UserStr1 + ", " + ServerTime1 + ": " + "" & strInput & "

________________________________________
" + DescriptionBefore1 + ""
' Req_Fields("RQ_DEV_COMMENTS").Value = DescriptionBefore1
'Bug_Fields("BG_USER_25").Value = "" + UserStr + ", " + ServerTime + ": " + "" & strInput & "

"
' Template_ActionCanExecute = False
' End If
'*****************************************************************

'**************************************************************************************Test plan module***********************************************************

'-----------------------Start latest comments at the top ---------------------------------------------------------------------------------------------------------------------
If ActionName="BugAddDevCommentsAction1" Then
dim DescriptionBefore1
dim ServerTime2
dim UserStr2

DescriptionBefore1 = Test_Fields("TS_DEV_COMMENTS").Value

'remove html tags
If Len(DescriptionBefore1) <> 0 then
DescriptionBefore1 = Replace(DescriptionBefore2, "<html><body>", "")
DescriptionBefore1 = Replace(DescriptionBefore2, "</body></html>", "")
end if

UserStr2 = User.FullName
If Trim(UserStr2) = "" then
UserStr2 = User.UserName
Else
'concatenate user's full name with username
UserStr2 = UserStr2 + " &lt;" + User.UserName + "&gt;"
End if

ServerTime2 = CStr(TDConnection.ServerTime)
'strInput = inputBox ("Enter Comment for change")
DescriptionBefore1 = "" + UserStr2 + ", " + ServerTime2 + ": " + "" & strInput & "

________________________________________
" + DescriptionBefore2 + ""
Test_Fields("TS_DEV_COMMENTS").Value = DescriptionBefore1
'Bug_Fields("BG_USER_25").Value = "" + UserStr + ", " + ServerTime + ": " + "" & strInput & "

"
Template_ActionCanExecute = False
End If
'*****************************************************************

 

If ActionName = "FieldComments.AddComment" Then
Bug_Fields("BG_DEV_COMMENTS").IsReadOnly = False
End If

'If ActionName = "FieldComments.AddComment" Then
' Req_Fields("RQ_DEV_COMMENTS").IsReadOnly = False
'End If

If ActionName = "FieldComments.AddComment" Then
Test_Fields("TS_DEV_COMMENTS").IsReadOnly = False
End If

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

It is not clear to me exactly what you want to accomplish.

If you just want to trigger on an Action in a specific module and the Action names are the same in another module (very bad implementation by Micro Focus, by the way), then check the value of the ActiveModule variable.

If you want to take care of the case when users enter a comment without clicking the Add Comment button, then you should catch the Test_FieldCanChange event. The Action you are catching now will only trigger when the button is clicked, so in that case your code will not do what you need.

If you want to make sure that users add a comment whenever they update the Test, then you need to add code to Test_CanPost that checks if the Comments field has been updated or not.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Nani1 Frequent Contributor.
Frequent Contributor.

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

The code i am trying is ... my users have a feasibility to enter comments in requirements module , test plan module and defect module. And the latest comment should be at the top of all comments. Along with user name , date and timestamp. 

 working fine in defect module with the above code but when i implement the same for test module and requirement module then facing the issue. 

Issue : When user click on add comment in Test plan module then comment is getting added  but at the same time a blank comment with user name & time stamp is added to a defect which previously selected or highlighted.

if i place use Test_Canpost event then it will madate users to enter the comment i guess. which i dont want.

if user want to enter comment then he should click add comment button and add the comment , else no action should happen. Hope i am clear. Sorry if it is confusing.... Please help me on how to fix this..

0 Likes
Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

You need to limit the code to execute in Test Plan only by checking the value of the ActiveModule variable.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Nani1 Frequent Contributor.
Frequent Contributor.

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

Can you please tell me on how to limit the code. 

in my if condition do i need mention activemodule as "Testing" or "Test Plan"

If ActiveModule = "Testing" and ActionName="BugAddDevCommentsAction1"  then <<code>>

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

If ActiveModule = "Test Plan" and ActionName="BugAddDevCommentsAction1"  Then...

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Nani1 Frequent Contributor.
Frequent Contributor.

Re: When i add comments in Test plan, then getting updated in defect (defect module)

Jump to solution

Thank you very much. Its working now : applied for both defects and test plan modules.

If ActiveModule = "Test Plan" and ActionName="BugAddDevCommentsAction1"  Then << code>>

If ActiveModule = "Defects" and ActionName="BugAddDevCommentsAction1"  Then << code>>

 

0 Likes
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.