Clearing a field after it is used to conditionally create subtasks via Groovy's "Create a Subtask"

Adam Smith July 31, 2014

Hello. I'm developing a workflow and have hit a roadblock. The idea is to create a number of subtasks (1-7) based on a user's selections in a multi-checkbox custom field that appears on the transition screen. I'm successfully creating these subtasks using a conditional.

The subtasks are created multiple times: the transition points from "In Progress" to "In Progress" and the creation loop is iterated with varying sets of subtasks until all 7 are perfect on the same loop - basically it's a QA process.

The end user has requested that the check box clears each time, so they don't have to unselect the previous choices before selecting the new ones. By idea for this was to clear the field after creating the subtasks. I've tried putting the Clear Field Value post function at the end of the list, but that does nothing. Any ideas would be appreciated.

Adam


5 answers

1 accepted

1 vote
Answer accepted
Adam Smith August 13, 2014

I got this working! Thanks for the help. The problem turned out to be I had the clear function pointing at the wrong field. Dumb mistake that was too obvious to notice at first. Here's what ended up working:

1st position: system default post functions (comment, transition, store, etc)

2nd position: subtask creation using script runner

3rd position: Clear Custom Field post function set to the multi-checkbox field.

Done in this order the subtasks create, the field clears and then checkboxes are clear for the next transition. When I placed the Clear post function earlier the boxes would clear but the subtasks would not be created as the condition wasn't true: the required values weren't set in the field anymore.

Thanks again for the help.

1 vote
Alexey_Rjeutski__Polontech_
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.
July 31, 2014
Try to use update custom field instead of clear and leave value box empty. As for my experience clear field dysfunction is little bit buggy
Adam Smith July 31, 2014

Thanks for the idea!

I gave this a shot and it doesn't seem to fire correctly. Even if I run the Update Custom Field post function very first, all the selected boxes still fire subtasks and remain checked at the next transition. Do you have any ideas about where it needs to be places relative to the system post functions?

Alexey_Rjeutski__Polontech_
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.
July 31, 2014

I put that postfunction in 2nd place on update transition and on the 1st on create. Please try to put the creation of subissues before that postfunction.

Adam Smith August 1, 2014

I tried moving the post functions before, but no luck. I'll run this by the developer on my team when he get's back to the office Tuesday. Thank you for the help, it's much appreciated. I think if we can get the issue to reindex between the post functions this should work.

0 votes
JamieA
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.
August 4, 2014

Are you using script runner to create the subtasks?

I would put the "clear function" before the "store" function, then the "create subtask" function(s) last.

0 votes
Adam Smith August 1, 2014

I tried moving the post functions before, but no luck. I'll run this by the developer on my team when he get's back to the office Tuesday. Thank you for the help, it's much appreciated. I think if we can get the issue to reindex between the post functions this should work.

0 votes
Adam Smith July 31, 2014

Footnote: The field is definitely clearing with that post function. If I change the order I can prevent some or all of the subtasks from conditionally being created. Yet, when I open the transition screen again all the same boxes remain checked.

Clearing the boxes is my end goal.

Suggest an answer

Log in or Sign up to answer