Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: How to read parant folder name and all its child folder name

$
0
0

As Trudy wrote, the Test_MoveTo event handler is not called when you move a test from one folder to another, but when you select a test.

 

The event handler that you are looking for is Test_FieldCanChange : when you move a test fro one folder to another, its TS_SUBJECT field changes.

 

As tests are attached to test folders and as you can also move test folders, you also need to block these moves. The event handler in that case will be TestFolder_FieldCanChange because when you move a test folder, its AL_FATHER_ID field changes.

 

Here are examples of what you can achieve :

 

Function Test_FieldCanChange (FieldName, NewValue)
  On Error Resume Next
  If FieldName = "TS_SUBJECT" Then
    MsgBox "Moving Test '" & Test_Fields("TS_NAME").Value & "' from '" & Test_Fields("TS_SUBJECT").Value.Path & _"' to '" & TDConnection.TreeManager.NodeById(NewValue).Path & "'"
    Test_FieldCanChange = False
  Else
    Test_FieldCanChange = True
  End If
  On Error GoTo 0
End Function


Function TestFolder_FieldCanChange(FieldName, NewValue)
  On Error Resume Next
  If FieldName = "AL_FATHER_ID" Then
     MsgBox "Moving Folder '" & TDConnection.TreeManager.NodeById(TestFolder_Fields("AL_ITEM_ID").Value).Path & _"' to '" & TDConnection.TreeManager.NodeById(NewValue).Path & "'"
     TestFolder_FieldCanChange = False
  Else
    TestFolder_FieldCanChange = True
  End If
  On Error GoTo 0
End Function

Note that the parameters of the Test_FieldCanChange function have to be reversed from what the Script editor proposes (it proposes Function Test_FieldCanChange (NewValue, FieldName), which is wrong).

 

Also see how you can display the old and new paths for the moved test or test folder. Once you have both paths, you can be more precise, for instance by allowing a move within the same level of folders...

 

Finally, if you want to forbid  all moves, it is much more simple to use the group permissions : go to Tools / Customize / Groups and Permissions, select a group, and in the Permissions / Test Plan tab, uncheck Test / Update / Subject, Test Folder / Update / Parent Folder and Test Folder / Move.


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>