Java API - Get Elements Connect field display value

Table of contents

Use case

Display Elements Connect public (visible) values (e.g: in another addon).

Using the service

OSGi import

You need to add the following package 'com.valiantys.nfeed.api' to your OSGi dependencies instruction in the pom file. Like this:


Import-Package vs. DynamicImport-Package

The package can be added in the Import-Package section instead of the DynamicImport-Package. The issue with Import-Package is that is does not detect classes after install (if Elements Connect is installed or enabled after your add-on, API classes won't be loaded)

Accessing the service

This feature is provided by the IFieldDisplayService:

IFieldDisplayService example
import com.valiantys.nfeed.api.FieldDisplayResult;
import com.valiantys.nfeed.api.IFieldDisplayService;
import org.apache.felix.framework.FilterImpl;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;

public class ConnectAPIService implements InitializingBean, DisposableBean {

    private BundleContext bundleContext;

    private ServiceTracker serviceTracker;

    public String getDisplayResult(long issueId, String customFieldId) throws ExocetException {
        IFieldDisplayService fieldDisplayService = getFieldDisplayService();
        FieldDisplayResult displayResult = fieldDisplayService.getDisplayResult(issueId, customFieldId);
        if (displayResult == null) {
            return null;
        if (displayResult.hasError()) {
            // Throw exception or process error
			throw new RuntimeException(displayResult.getError());
        return displayResult.getDisplay();

    public IFieldDisplayService getFieldDisplayService() {
        return (IFieldDisplayService) serviceTracker.getService();

    public void destroy() throws Exception {

    public void afterPropertiesSet() throws Exception {
        final String filter = "(objectClass=" + IFieldDisplayService.class.getName() + ")";
        serviceTracker = new ServiceTracker(bundleContext, new FilterImpl(filter), null);;

OSGi Bundle - Important Note

Please note that referencing the bundle itself is not recommended, do not do this. You can get the service by its class as in the example above.

In case you still need to reference Elements Connect OSGi bundle directly by its name, it has changed as of version 5.13.22.

VersionBundle name
5.13.22 or latercom.valiantys.jira.plugins.elements-connect
before 5.13.22com.valiantys.jira.plugins.nFeed


The service above makes reference to classes provided by Elements Connect. You must make sure that Elements Connect is installed before accessing the service or even trying to reference it. This check must be done at runtime. If Elements Connect is not present and you try to use the service, your code might fail with a ClassNotFoundException.