Hi,
I've got a problem during my transitions :
I wrote a groovy post-function script that is executed during the closed transition of a child issue.
This script has to verify if all the other children of its mother are closed. If they are, the mother is put into a new status (and the current child close), otherwise, just the current child is closed.
But I have another requirement : when a user wants to put the mother into the new status (the same as precedent), a transition condition has to verify if all the children are closed.
So, the first script works, but when i add the second one into the mother new status transition, and when i want to close a child, the first script cannot put the mother into the new status because the second script detects a child not closed (the child is not closed yet).
How could i do ?
Thanks !
Regards.
I found a solution :
My first script (executed in the child close transition post-function) was executed BEFORE the issue passed in closed state. And that why the other script, executed when the mother have to be put in its new state detected the child not closed.
So, i put the first script in a transition condition to leave the closed state (i've got an administrator state in the child workflow, that be able to go everywhere from anywhere ...). Finally, the script is exetuted AFTER the child passed in closed status, and the mother script detects the child closed.
![]() |
Congratulations, that's it Have a chocolate! |
Thank you Jamie for your answers :)
Cool, well done. Enjoy that chocolate ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can't really get my head around your problem. Have you written your own code?
Perhaps you could use either or both of https://studio.plugins.atlassian.com/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Allsubtasksmustberesolved and https://studio.plugins.atlassian.com/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Transitionparentwhenallsubtasksareresolved.
Is what you are saying that, when you close the subtask, the parent should also close, but it doesn't because your condition is saying a sub-task is still open? If so try changing the order of events, make your post-function on the child run last.
Or you could detect if a post-function is running and ignore the condition, maybe by making the condition only valid for non-admin users, or by setting a session variable or thread-local or something. I'm sure there is an easier way than that though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your quick answer.
Is it easy to define a session variable ? I think it's the best way to solve my problem ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is what you are saying that, when you close the subtask, the parent should also close, but it doesn't because your condition is saying a sub-task is still open?
Yes it is. My child post-function script verifies if all other mother children are closed, and if it's true, it closes the mother. But in the close transition of the mother, there is a script condition that verify if all children are closed : so the first script calls the second (when all other children are closed) but the second script detects an opened child (the child who wants to be closed).
So i want my first script (post-function script on the child close transition) executed AFTER its status changement, because when the second script will be called, it will detects the child closed, and not opened ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the triple post ... :)
Jamie, I could use the ScriptManager, and get the current scripts (I suppose there is a getScriptObjects() method, or something), test it (is there 2 scripts running ?) and then make the condition non-valid, right ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the post-function is really the LAST post-function, you should not get this problem. Is it last?
Other methods are too complicated, and are working around an issue you should not really have, as far as I can tell.
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.