It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Simple Script Condition JIRA Script Runner

Chris Smith Jul 17, 2014

Simple question I hope. I have a custom field (titled - "issueClone") single line text field that I am trying to check on creation via Script Runner-->Script Validator-->Simple scripted validator . I have set the following combinations in the condition:

cfValues['issueClone']?.value != null

cfValues['issueClone']?.value == 'invalidclone'

cfValues['issueClone']*.value == 'invalidclone'

cfValues['issueClone'].value == 'invalidclone'

cfValues['issueClone'] == 'invalidclone'

cfValues['customfield_12345'].value == 'invalidclone'

etc.

No matter what I try whenever the user tries to create the issue the validator script throws the error. By default the field is blank. No matter what is in "issueClone", empty or not, the validator throws the error.

The end game here is that we are trying to prevent users from cloning clones. I have a post function that runs on "Creand adds "invalidclone" to the "issueClone" field once a clone is created. I was hoping that I could then use a simple script validator to throw the error if "issueClone" contained "invalidclone".

2 answers

1 accepted

1 vote
Answer accepted
JamieA Jul 17, 2014

If you want to check that it's not null, and assuming it's a text field, and really called issueClone (correct case and spacing?) then:

cfValues['issueClone']

is what you need. If it's actually called "Issue Clone", then use:

cfValues['Issue Clone']

If you want to block it unless the value is "invalidclone" then use:

cfValues['issueClone'] == 'invalidclone'

but I suspect you have the name wrong.

0 votes
Chris Smith Jul 17, 2014

Hi Jamie,

This worked for me.

cfValues['issueClone'] != 'invalidclone'

The field is named "issueClone" so that it displays at the bottom of the "Custom Fields" list and also it is not mistaken to other administrators as a general field due to the name format. The above works, so thanks for the suggestions.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

77 views 13 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you