I'm creating a workflow to create a custom list on login which needs to contain sub-items but it's doing something rather weird.
The list is created fine, and I can apply it to a entity and that works, but when clicking the dropdown on the Entity, it shows the actual List Name as the top most item. Looking at the actual List in the Customize screen shows how I would expect.
If I create a list manually with sub items it works fine, it seems that my workflow must be messed up somewhere but I can't figure it out.
Any ideas?
Below is a chopped down example which shows the same problem.
Function Template_CanLogin(DomainName, ProjectName, UserName) Set custom = TDConnection.Customization 'Connect to the TDConnection Set customLists = custom.lists 'Connect to the Lists item if customLists.IsListExist("SubItem_List") Then 'See if the list already exists Set custL = customLists.list("SubItem_List") 'Connect to this List Set nd = custL.RootNode 'Get all the items that are currently in that list For each delX in nd.Children 'Loop through each item found and delete them "else duplicates will occur on load" ndName = delX.Name 'Get the name of this item nd.RemoveChild(ndName) 'Pass the name to the .RemoveChild function Next custom.Commit 'Commit changes to the system else 'List is missing Set NewList = customLists.AddList("SubItem_List") 'List wasn't there so Create it custom.Commit 'Commit changes to the system End if Set customList = customLists.list("SubItem_List") 'Connect to the List Set node = customList.RootNode 'Connect to that lists RootNode Set NewListItem = node.AddChild("Releases") 'Create the top most item in the list that all sub items will be under 'Top item is now added and all is good. 'Adding Sub-Items seems to be where it trips up and grabs the list name as the top item For each child in node.Children 'Now loop through all items to find the new items Object if child.Name = "Releases" Then 'Is this the item we just created? nodeName = child.Name 'Yep, now use this as the parent for the next node msgbox "Found " & nodeName & " Adding child item" child.AddChild("Folder Name") 'Add a new Sub-Child item to what we just created earlier For each y in child.Children msgbox "Found " & y.Name 'Loop throguh looking for the item we just added to ensure it exists. Next End If Next Custom.Commit 'Commit all changes to the system Set custom = Nothing 'Clear all the variables Set customLists = Nothing Set customList = Nothing Set node = Nothing End Function
Thanks,
Mike