SlightlyLoony
Tera Contributor

find_real_file.pngHave you ever wished you could display a related list, but you couldn't figure out how to do it because the things you wanted to list were not related in the usual way (as either a related list or as a many-to-many list)? I recently had this happen to me, and I'd like to share the (easier than I expected!) solution.

find_real_file.pngThe starting point for me was the desire to show a list of CIs that a particular business service depended on. This would be a list of the CIs such as those that show up on the example Business Service Map shown at left (click to enlarge). All of those CIs are related to the parent business services through a web of relationships, not as related lists or many-to-many lists.

So how could I get something that looked like a related list, but shows the CIs that appear on the Business Service Map?

find_real_file.pngThe key trick involved is a feature called Defined Related Lists, which provides a way for you to use any method you'd like to generate a related list. I got here by clicking System Definition → Relationships. At right you can see the screen I used to create a Depends On defined related list for my purposes. The only tricky bit of code in there is the gatherIDs() function, which traverses the web of relationships recursively. There's one piece of that function that's worth understanding in detail: the if (...) statement followed by a continue statement. That little bit of code is just checking to see if we've seen a particular CI before, and if so, it skips the recursive exploration. This is a "cycle stopper" a common feature of web (aka networks) traversal — it's there to prevent circular references from recursing infinitely.

find_real_file.pngOnce I created this defined related list, I just went to a business service, right-clicked and chose Personalize → Related List, and I could see that the defined related list I had just created showed up in the list of available related list under the name I gave it. I just selected and added Depends On as a new related list. Voila! My new list showed up, just as you can see at left.

5 Comments