Forums

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

Getting current project with ScriptRunner returns null

Johannes
Contributor
March 16, 2020

Hello,

I am currently trying to hide some UI elements with the ScriptRunner "Hide system or plugin UI element" fragment.

However I am not able to get the current project.

I am using the following code but "jiraHelper.project?.key" returns null when I am opening the reports section of a JSD project (e.g. "jira/projects/GRUWI/reports/kb-requests-deflected/timescale/2")

import com.atlassian.jira.plugin.webfragment.model.JiraHelper
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

log.setLevel(Level.INFO)

JiraHelper jiraHelper = new JiraHelper();
log.info("key: "+jiraHelper.project?.key)

 

Thanks in advance

Johannes

1 answer

0 votes
Michal Gubis (migu) December 6, 2021

Hello Johannes,

I am having a similar problem. In case you solved it, could you please let me know how...

Thanks

Michal

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events