Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19: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.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ScriptRunner to say != Issue Type

Julia
Contributor
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
Contributor
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
Contributor
February 3, 2023

This worked 

0 votes
Julia
Contributor
February 3, 2023

for example, This doesn't work 

 

 

Screenshot 2023-02-03 at 9.24.07 AM.png

Julia
Contributor
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
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events