Hi all!
I need to create a sub task only when a custom field has a certain value, I read a lot here regarding Script Runner and Conditions and I managed to get mine to work using: cfValues["Team"]*.value.contains('Team Central') || ('Team Other')
BUT! On the production system, the teams have "-" on the name. Team-Central, Team-Other, in this case, the condition cfValues["Team"]*.value.contains('Team-Central') || ('Team-Other') doesn't work and it creates sub-tasks for all other teams.
I have no idea how to make the script read the team name correctly if it is having issues with the special character :( unfortunately, changing the field value is not possible in this case.
I also tried ('Team-Central') || ('Team-Other') in cfValues["Team"]*.value and changed double quotes for single quotes and so on, the condition is not being applied.
thank you in advance :)
Graci
what's the type of your custumfield? if it's multiselect then try this:
('Team-Other' in cfValues["Team"]*.value) || ('Team-Central' in cfValues["Team"]*.value)
if single select:
cfValues["Team"]?.value in ["Team-Other", "Team-Central"]
I believe it should work
Hi Ilya! It works! I am using multiple choice, forgot to mention.
Thank you so much for the really quick response and for solving my problem :))))
Have a great day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Ilya Turov , do you know how to avoid linking this sub-task to the epic of the US/Bug? The reporter doesn't want it to be linked and show up on the epic issues :|
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can add to your validator something like
&& !(issue.issueType.name in ["Bug", "Epic"])
basically, name all the issuetypes you want to avoid
i believe, there is something like this in builtin examples, cant check atm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
actually, he wants the sub-task to be created for US and Bug, I have added the post-function on both Workflows and this is working perfectly, but the sub-tasks are showing on the Epic linked issues and he doesn't want the sub-tasks linked there.
Here is how it is right now:
Since the sub-tasks (named "Merge") are like dummy tasks, they don't want it to be linked to the epic. That works when they create the US without an Epic Link and only link the epic afterwards, but they want to use the epic link when opening a ticket...
I googled it and everyone wants sub-tasks to be linked on Epics, this guy wants things the other way around :P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.