How to get Current Issue from AbstractWebCondition?

navya k 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
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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 December 15, 2019

@Tuncay Senturk 

Thanks for replying.

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

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2019

Are you getting null for jiraHelper?

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

navya k 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