Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

ScriptRunner Post-Function: Create Subtask Condition from Multi-select field

I am trying use Scriptrunner's "Create a sub-task" post-function to automatically create a subtask on a particular transition, and I'm having difficulty writing the condition. 

  • For MultiSelectField with 4 options (Option1, Option2, Option3, Option4):
    • Create a Subtask if Option1, Option2, and/or Option3 is selected. 
    • Do not create a Subtask if Option4 is selected (unless 1, 2, 3 is also selected).
    • Do not create multiple subtasks for each option, just one if 1, 2, 3 has been selected.

The Example Condition provided by ScriptRunner is close, but it only seems to work for one option, and I haven't figured out the syntax for multiple options.

SCRIPTRUNNER EXAMPLE

'My Value' in cfValues['My Multi List']*.value

Any help is greatly appreciated!

(Jira Server 7.9.2, ScriptRunner v5.4.12)

1 answer

1 accepted

2 votes
Answer accepted
Ravi Sagar Community Leader Oct 03, 2019

Hi @Timothy Ryner 

Try this code.

def values = cfValues['My Multi List']*.value
if ( values.contains('Option 1') || values.contains('Option 2') || values.contains('Option 3')) {
return true
} else {
return false
}

@Ravi Sagar , you have a gift, my friend.  Worked exactly as needed.

Like Ravi Sagar likes this

@Timothy Ryner 

I got same requirement can you please enhance full code to achieve as I'm new to script runner.

Hi @Mahesh Kallepalli , Did you manage to solve this, I am also new to script runner and have something similar.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

108 views 0 7
Read article

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