· Sep 27 2m read

Listing Production Item connections recursively

If you work with Productions, highlighting connections between Business Hosts is a very convenient feature, allowing developers to get a visual representation of a data flow.

This feature works by default with all system Business Hosts. If a user writes their own Business Services, Processes, or Operations, they must implement the OnGetConnections method for this functionality to work with their custom Business Hosts (or use Ens.DataType.ConfigName properties for connections).
That said, the SMP shows only the first layer of connections of the selected Business Host. Sometimes, we need to get connections of connections recursively to build a complete data flow graph. Or we might need this connection information to check which downstream systems might be affected by a change upstream.To do all that, I wrote an Utils.Connections class, which offers the GetConnectionsJSON method. You can pass an Item ID or Item Name, and it will return you a dynamic object containing all the connections. Here's how it works. Assuming this production:

You'll get this JSON for in.REST service (##class(Utils.Connections).GetConnections("in.Rest")):


Each item has an array of connections. If a connection has connections itself, it would be an object with an array inside, otherwise, it will be just a string.
There are also SQL queries to get connections for one item or list all connections for all items:

SELECT Utils.Connections_GetConnections(ID)
SELECT * FROM Utils.Connections_ListConnections()

Code on GitHub.

Discussion (4)2
Log in or sign up to continue