Quality Center / ALM Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

ALM 12.01 - How to restrict users from selecting parent items from a list?

SOLVED
Go to Solution
Highlighted

ALM 12.01 - How to restrict users from selecting parent items from a list?

Hi, 

We have list field in defects module where items are stored in hierarchy, so there are various parent, child and sub child nodes.

 

The users at the moment are able to select any of these items from the list while the requirement is that they should only be able to select an item with no further child items.

 

Could anyone please help as to how this can  be accomplished?

 

Many thanks

3 REPLIES
Honored Contributor

Re: ALM 12.01 - How to restrict users from selecting parent items from a list?

Assuming your field is BG_USER_01 and that you have set the Verify Value option, try adding this to Bug_FieldCanChange:

If FieldName = "BG_USER_01" AND NewValue <> "" Then
  Set theList = TDConnection.Customization.Fields.Field("BUG","BG_USER_01").List
  Set listNode = theList.Find(CStr(NewValue))
  If listNode.ChildrenCount > 0 Then
    Bug_FieldCanChange = False
    Exit Function
  End If
  Set listNode = Nothing
  Set theList = Nothing
End If
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]

Re: ALM 12.01 - How to restrict users from selecting parent items from a list?

Thank you sir, that was really helpful. Much Appreciated.

Honored Contributor

Re: ALM 12.01 - How to restrict users from selecting parent items from a list?

I forgot to add that a precondition for the code to work is that the list values are unique. If the same name appears both as a folder node and an end node, it could fail.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]