Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the current project name inside IssueCRUD servlet using Atlassian SDK?

Dhruv Dixit February 24, 2019

In the documentation provided by Atlassian for the IssueCRUD servlet, they have hardcoded the project name as "TUTORIAL" and it only works for it.

How could we get the current project that the Jira user is currently in and use that project name inside the IssueCRUD servlet so that the IssueCRUD servlet could be used for projects with any name instead of hardcoding the project name inside the code?

1 answer

1 accepted

0 votes
Answer accepted
Dhruv Dixit February 28, 2019

SOLVED:

Add the following inside your web-item in atlassian-plugin.xml:

<link linkId="project--web--item-link">/plugins/servlet/issuecrud?pname=${helper.projectObject.name}</link>

Add the following in doGet method of IssueCRUD:

iid= req.getParameter("pname").toString();

String "iid" stores the project name.

Now, use the string "iid" inside your queries  in IssueCRUD as follows:

Query query = jqlClauseBuilder.project(iid).buildQuery();

Suggest an answer

Log in or Sign up to answer