How Do I Conditionally Create A Subtask Using Script Runner Plugin?

I'm trying to conditionally create a subtask based on the value of a custom field. I'm using the script runner plug-in, but can't get the Condition to work. I've tried:

cfValues['customfield_10602'] == 'Client Funded'

But the subtask doesn't get created, even when I have Client Funded value checked on the parent.

The customfield_10602 is a group of checkboxes, and 'Client Funded' is one of the possible choices.

Anyone have any suggestions?

1 answer

1 accepted

1 vote
Henning Tietgens Community Champion Nov 14, 2013

Try

cfValues['customfield_10602']*.value.contains('Client Funded')

cfValues[] returns a list of Option objects if it's a multi select custom field.


Thanks! In addition to the change you suggested, I also found that I needed to provide the name of the custom field (not id). So I finally got it working using this condition:

cfValues['Enhancement Attributes']*.value.contains("Client Funded")

Henning Tietgens Community Champion Nov 14, 2013

Ah, good catch. I didn't noticed that. :-)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

816 views 2 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you