The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How do I get the value of issuetype[ScriptRunner]

arno
Contributor
March 12, 2024

Hi all

We are writing a behaviours recently. We want to implement different question types and the user can see different option values in the custom fields. However, I found that my code did not work. Did I not get the correct issuetype? Our code is as follows


def field = getFieldById(getFieldChanged())
def department = getFieldByName("Department")
def value = field.getValue()

if (value == 'story'){

    department.setFieldOptions(['SW','HW'])

}else{

    department.setFieldOptions(['SW','HW','RF'])
}

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Matt Parks
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 Champions.
March 12, 2024

This is how you get the value of the Issue Type in a string format so you can run your if statement against it:

 

def issueType = underlyingIssue.getIssueType().name
if (issuetype == 'Story')
I don't know off the top of my head whether this is case-sensitive, but I always assume that it is.
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events