Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting current project with ScriptRunner returns null

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

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
Community showcase
Published in Jira Service Management

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

723 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you