ScriptRunner to say != Issue Type

Julia February 3, 2023

I want this script to run on all issues that are NOT of the Initiative type. 

How can I say in the if & else statements to only do these things if the issue type is not Initiative. 

 

I tried 

def issueTypeField = GetFieldByName("Issue Type")

def issueType = issueTypeField.getValue() 

if (parent link == null && issueType != "Initiative")

 

but that didn't work... any help? 

Screenshot 2023-02-03 at 9.18.35 AM.png

2 answers

1 accepted

1 vote
Answer accepted
Julia February 3, 2023
//parent link

def parentLinkField = getFieldByName("Parent Link")

def typeOfWorkField = getFieldByName("Type of Work")

def parentlink = parentLinkField.getFormValue()

if (issueContext.issueType.name == "Initiative") {

typeOfWorkField.setRequired(false)

typeOfWorkField.setHidden(false)

}

else if (issueContext.issueType.name !== "Initiative" && parentlink == null ) {

typeOfWorkField.setRequired(true)

typeOfWorkField.setHidden(false)

}

else if (issueContext.issueType.name != "Initiative"){

typeOfWorkField.setRequired(false)

typeOfWorkField.setHidden(true)

}
Julia February 3, 2023

This worked 

0 votes
Julia February 3, 2023

for example, This doesn't work 

 

 

Screenshot 2023-02-03 at 9.24.07 AM.png

Julia February 3, 2023

Also not working 

 

Screenshot 2023-02-03 at 9.59.21 AM.png

Suggest an answer

Log in or Sign up to answer