Proper way of getting outbound dependencies

Enonic version: 6.15.8
OS: Mac

Hello, what is the correct way of getting the outbound dependecies of a content? (as show in the Dependecies widget).

The node has a _references field(?) that can be used in a query, but it is not present on the object returned by either get/query functions on either the content or node/RepoConnection libs.

I have tried using the getOutboundDependencies method of the com.enonic.xp.core.impl.content.ContentServiceImpl class, but I don’t know how to properly hook into a currently running content service or initializing a new one.

So, what is the proper way of getting outbound dependencies of a content?


As you already found out, ContentService has already a method “getOutboundDependencies” but yes it is not exposed in the content library.

  • The proper way would be for us to add this function in the content library. I will create an issue about it.

  • But if it cannot wait and to answer your question, here is is how to use a service from JS code:

Create a Java class implementing the interface “ScriptBean”
Look at the initialize method in the example above for how to retrieve available services.

Instantiate this script bean and call its method from JS

1 Like

We should support both getInboundReferences getOutboundReferences in this case…

1 Like

Thank you, the ScriptBean way worked perfectly :slight_smile: