Highlighted
majgotra_nyc Valued Contributor.
Valued Contributor.
417 views

Want to prevent user for moving/copy-pasting testset to a testsetfolder based on certain condition

Problem statement

Want to develop a workflow script that could prevent user to either move an existing testset or copy/paste an existin testset to a new testset folder if the folder doesn't have assigned release cycle.

I'm able to develop a workflow scipt to prevent from adding tests to testset which doesn't have a testsetfolder with assigned release cycle using below code

 

Function TestSet_CanAddTests(Tests)
' On Error Resume Next

IF IsEmpty(TestSet_Fields("CY_FOLDER_ID").Value.TargetCycle) Then
msgbox "No Associated Cycles found with Parent Folder."
TestSet_CanAddTests = False
Else
TestSet_CanAddTests = True
End If


'TestSet_CanAddTests = DefaultRes
On Error GoTo 0
End Function

Any help or sample code would help.

Tags (1)
0 Likes
2 Replies
Carlos_S_ALM Super Contributor.
Super Contributor.

Re: Want to prevent user for moving/copy-pasting testset to a testsetfolder based on certain conditi

Greetings.

We hope you are well.

Let us investigate the request with our collaboration team to provide you an update ASAP.

Regards,

 

Carlos Solis Perez
Software Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.

If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the option at the bottom left of the post and show your appreciation.
0 Likes
bernalrojas05
New Member.

Re: Want to prevent user for moving/copy-pasting testset to a testsetfolder based on certain conditi

Hi majgotra,

Basically in order to achieve a similar task for the copy/paste of the TestSets you can use the below workflow code (similar to yours) in the ActionCanExecute function in Common script section.

As you can see,  we cannot longer use the "IF IsEmpty(TestSet_Fields("CY_FOLDER_ID").Value.TargetCycle) Then" line because when pasting the TestSet to the target Folder the "current entity" continues to be the TestSet being copied, so it would retrieve the CY_FOLDER_ID for that TestSet instead of checking the target TestSet Folder. So we need to replace that line and have ALM to check the CF_ASSIGN_RCYC field from the CYCL_FOLD table instead:

 

Function ActionCanExecute(ActionName)
  On Error Resume Next

  If ActionName = "TestLab.Paste" or ActionName = "Testlab.PasteInTree" Then

    If TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsNull then
         msgbox "No Associated Cycles found with Parent Folder."
        ActionCanExecute = False
    Else
        ActionCanExecute = True
    End If

  End if
 ' ActionCanExecute = DefaultRes
  On Error GoTo 0
End Function

 

Unfortunately, for the "move" request, ALM does not trigger a specific "Action" that we can catch to include in the "If" condition, so this will work for copy/paste only.

Hope this will be helpful for you.

Regards,

Bernal Rojas Navarro
ALM/Quality Center
SW Support Technical Consultant

 

 

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.