Forums

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

How to get Current Issue from AbstractWebCondition?

navya k
Contributor
December 10, 2019

I found this code:

Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
JiraHelper jiraHelper = new JiraHelper(); // doesn't work

This code is in my class which extends AbstractWebCondition.

1 answer

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
December 14, 2019

Hi @navya k 

You can't use JiraHelper by creating instance with new JiraHelper().  

In order to get the issue in a class that extends AbstractWebCondition, you should override the shouldDisplay method as follows and use jiraHelper this way

@Override
public boolean shouldDisplay(ApplicationUser user, JiraHelper jiraHelper) {
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
}

I hope it helps

navya k
Contributor
December 15, 2019

@Tuncay Senturk _Snapbytes_ 

Thanks for replying.

I'm following the same way, but I'm getting null for jiraHelper.

Tuncay Senturk _Snapbytes_
Community Champion
December 15, 2019

Are you getting null for jiraHelper?

Where are you using this WebCondition? Can you give some details?

navya k
Contributor
December 15, 2019

I have created Web item and added 

WebItemIssueCondition extends AbstractWebCondition {

public boolean shouldDisplay(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
}
}

 and getting null for jiraHelper.

Suggest an answer

Log in or Sign up to answer