Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

AbstractJiraContextProvider for Project Menu return null Project

Cuong April 15, 2015

Hi,

I'm developing a simple Menu for Project and want to get the project Id of that selected project.

https://developer.atlassian.com/jiradev/jira-platform/projects/design-guide-jira-project-centric-view/development-guide-jira-project-centric-view#Developmentguide-JIRAproject-centricview-scopefilters

But i'm stuck at

jiraHelper.getProjectObject()

return null everytime.

 

@Override
    public Map getContextMap(User user, JiraHelper jiraHelper) {
        Map contextMap = new HashMap();
        try {            
            Project p = jiraHelper.getProjectObject();
            contextMap.put("ProjectId", p.getId());
            contextMap.put("ProjectName", p.getName());
            
        } catch (NullPointerException npe) {
            
            contextMap.put("ProjectId", "NPE");
            contextMap.put("ProjectName", "NPE");
        }
        return contextMap;
    }

I saw in javadoc said it can be null, but what is a correct way to get this simple info?

https://docs.atlassian.com/jira/latest/com/atlassian/jira/plugin/webfragment/model/JiraHelper.html#getProjectObject%28%29

Thanks and best regards,

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Cuong April 16, 2015

I can not get "atl.jira.proj.config" working. I'm using Jira 6.4 sdk. Add something like this: <web-section key="my-custom-group-of-tabs-section" ... location="atl.jira.proj.config" ...> ... </web-section> in atlassian-plugin.xml have no use. Any idea?

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2015
TAGS
AUG Leaders

Atlassian Community Events