Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
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 ?
In behaviours you can either use the underlyingIssue variable or getIssueContext()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As @Kabelo Mokgoro suggests, underlyingIssue is correct for a Behavior server-side script.
issueContext is not of type issue.
For example:
def wf = workflowManager.getWorkflow(underlyingIssue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have same problem
my code is
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def textCf = customFieldManager.getCustomFieldObjectByName("Client")
String clientName = underlyingIssue .getCustomFieldValue(textCf)
but i get error "the variable underlyingIssue is undeclared."
i have tried with issue. and then get error "the variable issueis undeclared."
so can you help me pls.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ragif.ahmadov to get the field value you can directly use like this -
String clientName = getFieldByName("Client").getValue()
no need for IssueContext. Just make sure the field should be present on the form/pop-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have already tried using "issue" object, but it is giving me the error 'the variable [issue] is undeclared'.
Please refer the logs attached.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That suggests that you have not used the last line of Suhas's code to get the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should use 'issueContext' instead of 'issue'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried to use issue context and got the results?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.