Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I use a Post-Function to create a sub-task based on a condition?

Rob Fox March 27, 2015

I have read https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Createasub-task and this quite clear to me, what is not clear is if I only want to auto-create the sub-task as a post-function if the parent task has a specific value for a custom field.

There's no way to indicate conditionality - which I am guessing needs ot be done as a custom function - is there a complete example anywhere of a script that does exactly what the built-in does, but only if a particular custom field has a specific value?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Tim Eddelbüttel
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.
March 29, 2015

Hello Rob,

you can add a condition to the post function.

Here is an example for issue type combined with a multi select list.

issue.issueTypeObject.name == 'Windows 7 Migration' && cfValues['Migration Sub Tasks']*.value.contains("IT-Network")

Regards,
Tim

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
March 27, 2015

You would need to write the groovy code to implement your condition check and only execute the create portion of the code if the condition was met.

For those that don't want to do the programming, Create on Transition for JIRA's Create Subtask has conditioning built in expressed using regular expressions and Substitution variables.

 

TAGS
AUG Leaders

Atlassian Community Events