It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to dynamically show and hide web-panel depending on particular condition

I have a web panel on issue page that web panel should be display for a particular project (not for all project) which are store in my AO table.

The projet which are present in AO table for that project only i have to show web panel otherwise it will be hide

15 answers

This is xml file :

<web-panel name="WorkBreakdownStructure" i18n-name-key="" key="work-breakdown-structure" location="atl.jira.view.issue.left.context" weight="100">
    <description key="work-breakdown-structure.description">The WorkBreakdownStructure Plugin</description>
    <label key="work-breakdown-structure.title"/>
    <context-provider class="com.jira.example.web.contextproviders.WBSContextProvider"/>
    <resource name="view" type="velocity" location="templates/webpanels/wbs-indicator.vm"/>
   <condition class="com.jira.example.condition.wbsConfiguration" invert="true" />

wbsConfiguration is class file

public class wbsConfiguration extends AbstractIssueCondition {

	private static  ApplicationProperties ap;
	private final ActiveObjects ao;
	WbsGenerator wbsGenerator;
	public wbsConfiguration(ActiveObjects ao, ApplicationProperties ap2)
	    wbsGenerator = new WbsGenerator(ao,ap2);

	public boolean shouldDisplay(User arg0, Issue arg1, JiraHelper arg2) {
		boolean flag=false;
		//here u write u r logic for whic project u want to show web panel
			flag = false;
			flag = true;
		return flag;


if flag is false then panel get display

we can also refere cookbook in that search webpanel condition

Thanks Sachin.I too did the same way. But its like i am hardcoding the project name like this


(projKey == "nn")

return true;


return false;

How can i get rid of this?Its like to whichever project i dont want the web-panel to get displayed i need to check in this class file. Is there a way by which we can avoid this hardcoding.

Go to this link : ""

here you get how to create AO table information please like the answer if it helpful for you

Thank you Sachin . Do we need to get AO installed or does it come part of the JIRA's higher version. Because i read that Active Objects shouldnt be installed in production environment?

1.First u have to store projectName in AO table

if its dine then from condition class u have to retrive that data

and check wheather current project is present in that or not

refer jira development cookbook for store , delete and access data from AO table

You have to make module for this called webwork

so it will create section in administartion part

in that section you can make GUI and write buisness logic

just search how to create administraion section on net

Something similar to this?

So on a higher level view what i understood is in your atlassian.xml gadget of your gadget you have added another module "webwork". You make the required GUI for it and wrote your business logic to load the projects into it. The logic of this says is written in a file. This been referred to the context-provider section of your webpanel?

Have in understood correctly? How are you listing out the projects in your GUI? If you dont mind can you post your implementation. I tried using a rest service but its not working.

how to get due date on dashboard? not on project page or issue page


use this for grtting all project in jira

ProjectManager myProjectManager = new ProjectManager()

public List<Project> getAllProjects() {
return myProjectManager.getProjectObjects();

ProjectManager is object you have to inject it constructer

this will return list of project

in vm file you have to call methos and iterate it

#foreach($p in $action.getAllProjects())
<option value="$">$</option>

Have you tried adding the condition to your web-panel. Read here.

Yes but it check for jiras inbuilt condition

i want to check by programmatically

<condition class="com.jira.example.condition.wbsConfiguration" invert="true" />

create one class called wbsConfiguration and extend AbstractIssueCondition class

but AbstractIssueCondition is deprecated method is there any method for this

Hi Sachin. I too have the same requirement where i want my web-panel to get displayed for particular project and not all. I checked the web-panel package from here. But i didnt find any suitable condition to add in the atlassian-plugin.xml page. Did youget this resolved?

<condition class="com.jira.example.condition.wbsConfiguration" invert="true" />

use this in .xml file in your

wbsConfiguration is a class in that you have to right u r logic

if condition is true the return flase

if condition false then panel get display otherwise it hide

Thanks Sachin, Can you share your code for understanding

as well as the condition part of xml file

my question is how u decide for which project you want webpanel.

if you have separate GUI for this then

you can store the project key in AO table for which you want to display webpanel from that GUI

and then check whether selected project key present in AO table or not if not then hide web panel.

so it will be dyanamic

Thanks Sachin. Since i have recently started coding in JIRA i dont have ideahow to create an AO Table. Do you have any links/tutorial which explains this.

Need some help here.

Step 1: I have a plugin created, which is appearing on the jira issue view page

Step 2: Added these dependancies in the pom.xml file




step 3: added this in atlassian.xml

<ao key="ao-module">
<description>The configuration of the Active Objects service</description>

<component-import key="ao" name="Active Objects components" interface="com.atlassian.activeobjects.external.ActiveObjects">
<description>Access to the Active Objects service</description>

step 4: created a package and added an interface named ProjectEntity

package com.example.plugins.entity;

public interface ProjectEntity extends Entity
public String getProjectName();
public void SetProjectName(String Name);

step5: Added a class named AOClass

when i import this



<font></font> com.atlassian.activeobjects.external.ActiveObjects;

i get namespace not resolved.

i am stuck here, how can i proceed further


public interface name extends Entity{

    String getColumnData();
    void setColumnData(String columnData);   

write entity file like this

Thanks did that. But why is Preload required?

Thanks did that. But why is Preload required? Seems like the resolve error of active object namespace resolved too by doing atlas clean

This is my atlassian-plugin.xml

<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/>

<web-panel name="DueDateIndicator" i18n-name-key="" key="due-date-indicator"

location="atl.jira.view.issue.right.context" weight="1000">

<description key="due-date-indicator.description">The DueDateIndicator Plugin</description>

<context-provider class="com.example.plugins.tutorial.DueDateIndicator"/>

<resource name="view" type="velocity" location="due-date-indicator.vm"/>

<condition class="com.example.plugins.entity.Enabledprojects"></condition>

<label key="due-date-indicator.title"/>


My webpanel is DueDateIndicator

I have created a project entity class to get and set the project list as follows

package com.example.plugins.entity;




public interface ProjectEntity extends Entity


public String getProjectName();

public void SetProjectName(String Name);


My condition class is Enabledprojects

package com.example.plugins.entity;
import com.atlassian.activeobjects.external.ActiveObjects;
public class Enabledprojects
private final ActiveObjects ao;
public Enabledprojects(ActiveObjects ao)
{ = ao;
Now how do i proceed to get the list of projects which i have created in JIRA and how can i store this in active objects

I did refer the cookbook howeveer have some doubts. Can you share how have you stored the projectnames in AO table? Do you do this in Entity interface?

What i have done is i have an entity class "ProjectEntity " and i have getter and setter for ProjectName and ProjectId.

Now i have a class called "Enabledprojects". According to the book what i understood is that we need to add all the projects to the project entity and use the activeobject to get the projects. In case if i have some 40 projects then i need to add one by one to this list?? is there any other way to do this? Can i have all the project list stored in one xml file and load the data from this xml file?

For example, we need to store the name, city and country as part of the address
entity. In this case, the AddressEntity interface will look like the following:
public interface AddressEntity extends Entity{
public String getName();
public void setName(String name);
public String getState();
public void setState(String state);
public String getCountry();
public void setCountry(String country);

By doing this, we have setup the entity to facilitate the storage of all the three attributes.
We can now create, modify, or delete the data using the ActiveObjects component.
The component can be instantiated by injecting it into the constructor.

private ActiveObjects ao;
public ManageProperties(ActiveObjects ao) { = ao;

A new row can be added to the database using the following piece of code:

AddressEntity addressEntity = ao.create(AddressEntity.class);

Details can be read either using the id, which is the primary key, or by querying the data
using a object. Using ID is as simple as is shown next:

AddressEntity addressEntity = ao.get(AddressEntity.class, id);

The Query object can be used as follows:
AddressEntity[] addressEntities = ao.find(AddressEntity.class, Query.
select().where("name = ?", name));
for (AddressEntity addressEntity : addressEntities) {
State:"+addressEntity.getState()+", Country:"+addressEntity.
Here, we are querying for all records with a given name.
Once you get hold of an entity by either means, we can edit the contents simply by using the
setter method:
Deleting is even simpler!
Hopefully, that gives a fair introduction to active objects.

thanks i did read this from cookbook as suggested by you. I just have a small doubt. If we use the internal db HSQL which would contain the list of projects in it then i guess we need to use only the select query to retrieve all the projects rgt?we need not use create/delete when its just retreiving records. Am i right?

yes i just give you that for feature use

Hi Sachin.

Could you please share your code for the hiding and displaying of web-panel. I was doing some other dev so cudnt try this. But now i need to implement this and somethings are not working. Can you please share you code for this so that i can relate to what i am doing. I am still not clear about implementing the active objects.

Did you create a separate GUI for your project lists? Could you explain your code.


just refer my first answer

in that u have to make change in xml file add this in web panel

<condition class="com.jira.example.condition.wbsConfiguration" invert="true" />

create wbsConfiguration class in that write u r buissness ligic

for project list i have create seperate GUI with that user can select project

This GUI is another gadget i suppose? Is this configured in dashboard? How do these gadgets talk with each other?

I mean i thought that the GUI you are talking about is another gdaget which is added to a dashboard and the user can select the projects which will generate an o/p of xml file with selected project lists and this would be then fed as an input to the gadget in issue view page. Then we have a condition to check if the current project is among the list of selected projects, if yes then display the gadget which is in the issue view page else hide it.

How have you implemented this ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Keep your team in the loop with Team @mentions in Jira Software!

Hi everyone! My name is Jenny, a Product Manager at Atlassian. After launching Team @mentions in Confluence, we heard a lot of positive feedback from customers that they love how easy it is to @men...

561 views 6 18
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you