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

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 Leaders.
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.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events