Simple script validator question

JAY KAPADIA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 9, 2018

I am trying to create a simple script validation on the creation of a ticket of type bug where it should throw an error if the epic field (custom field) is empty. Below is what I have written. Once I activate this it always shows (even if the epic link (cfValues[11240]) is filled up). What am I doing wrong?

 

issue.issueType.name != 'Bug' || cfValues[11240]

 

 

2 answers

1 vote
Mark Markov
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.
July 10, 2018

Hello @JAY KAPADIA 

it should be like this

if (issue.issueType.name == 'Bug' && cfValues[11240] == null) {
return false
}
else {
return true
}
0 votes
Alexey Matveev
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.
July 9, 2018

Hello,

Try to log info and have a look what is going wrong. For example like this:

log.error("issue.issueType.name: ${issue.issueType.name}")

log.error("cfValues[11240]: ${cfValues[11240]}")

issue.issueType.name != 'Bug' || cfValues[11240]

The logs will be in the atlassian-jira.log file

Suggest an answer

Log in or Sign up to answer