Get Filter from Gadget & get gadgets from dashboard


is there a possibility how to get the filter of a gadget? I want to retrieve all issues in a filter. And this filter I want to access by a gadget. I know it is possible to get all issues in a filter. But my point is to get the filter via an Gadget-Object.

How can I do this programmatical?

Another question:

Can I iterate over all gadgets in a dashboard? I want to get all gadgets that are contained in a dashboard. If I got these gadgets, I could get the filter.

By the way are there any event-listener for dashboards? So when dashboard is updated an event will be triggered. I found for example listener for projects or issues but nothing for dashboards or gadgets.

Thanks in advance for any help.

4 answers

1 accepted

0 votes
Accepted answer

Solution can be found on

0 votes
Timothy Chin Community Champion Jun 30, 2014

If I'm not mistaken, you can get the gadget's infomration if you get the gadget object.

Can I iterate over all gadgets in a dashboard?


By the way are there any event-listener for dashboards


This class DefaultPortalPageService should get you unstuck.

Thanks for your answer.

The PortalPageService is the top level service for Dashboard operations. For historical reasons, Dashboards were called Portals and hence the prefix "Portal" is used consistently throughout the code.

See follwing link:

When I have a PortalPage/Dashboard, how can I access all the gadgets in this dashboard?

I have following Java Code:

User user = (User)ComponentAccessor.getCrowdService().getUser("admin"); 
       PortalPage portalpage = ComponentAccessor.getComponent(PortalPageService.class).getPortalPage(new JiraServiceContextImpl(user), (long)10201);

//how to get all gadgets with portalPage

Is there a way to get all gadgets with portalpage or another way how to iterate over all gadgets? If possible a little code sample would help me further.

OK, I found a solution.

You can't access all gadgets directly from the PortalPage instance. Instead you need to use the PortalPageService right from the beginning to access all PortletConfigurations like in the Code-Listing below:

List<List<PortletConfiguration>> portletConfigs = pps.getPortletConfigurations(new JiraServiceContextImpl(user), (long)10202); // pps is instance PortalPageService

And now with the List of the List of PortletConfigurations you can iterate through all GadgetURIs and you can access all Queries like:

for(int i = 0; i<portletConfigs.size(); i++)
 	List<PortletConfiguration> llconfigs = portletConfigs.get(i);
  	for(int j = 0; j<llconfigs.size(); j++)
             PortletConfiguration pc = llconfigs.get(j);
   "QUERY:" + pc.getGadgetURI().getQuery());

It (PortalPage) no longer has a link to the PortletConfigurations (Gadgets) displayed on a dashboard. To get this information one should consult the PortalPageService directly.

Atlassian JIRA API

Unfortunately, whenever I call the method getQuery, it will return null, although a filter were defined in the corresponding gadget. What is wrong? How can I get the filter/query from every gadget?

Does anybody have an idea or a hint, how to get the Filter/Query of a Gadget receiving from the GadgetURI as mentioned above? Is it possible via the JIRA API 6.2.7 or do I have to consult the REST API?

Is it possible to access a gadget from java code that you have created before in a dashboard? And get its query somehow? How is a Gadget defined in the JIRA API?

Please help me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

919 views 3 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you