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

How to get current issue object in Behaviour ?


I am using JIRA version 7.2.9 and Script Runner version 5.0.4.

I want to set the Security Level for the current issue object in Behaviour. But I am not able to get the current issue object.

Can someone please help ?

2 answers

2 votes

In behaviours you can either use the underlyingIssue variable or getIssueContext()

In actual script you can use 'issue' for current issue object.


For testing in script console you can use following,

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.getIssueManager()

def issue = issueManager.getIssueObject("ABC-123") 


I have already tried using "issue" object, but it is giving me the error 'the variable [issue] is undeclared'.

Please refer the logs attached.


That suggests that you have not used the last line of Suhas's code to get the issue.

I wan't to get current issue in Behaviour, in this case I will directly use 'issue' for current issue object (as depicted in screenshot below). Am I right ?capture2.png

You should use 'issueContext' instead of 'issue'.

@Suhas Patil 

Have you tried to use issue context and got the results?

@Paridhi Agarwal Have you tried using the "underlyingIssue" variable instead?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Jira Cloud for Google Sheets: Automatically Refresh Your Data!

Remember that time you realized it was possible to refresh your Jira data in Google sheets with just one click? What if we told you that you can now get the latest data with no clicks at all?! Zero! ...

7,369 views 33 29
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