JIRA Workflow Toolbox conflicts with ScriptRunner for JIRA plugin
Setup- JIRA Version 6.4.13 Adaptavist ScriptRunner for JIRA Version: 4.1.3.12 JIRA Workflow Toolbox Version:2.2.11
There is an issue with a Post Function when using the JIRA Workflow Toolbox. It seems to interfere with the Fire a Issue Closed event that can be processed by the listeners.
If I remove my Post Function the Issue Closed event works fine and Script Runner sends a custom email.
However, if I leave the JIRA Workflow Toolbox Post Function in, the Issue Closed event doesn't get registered and no Script Runner email is sent.
This is a snippet of the code for the Post Function:
Value of field Ephemeral string 1 in current issue will be copied to field Issue status (delayed writing) in linked issues or subtasks filtering by:
Inward issue link types: none
Outward issue link types: none
Subtasks won't be written.
Sibling subtasks fulfilling conditions on issue type, status and project will be written.
Issue types: Conditional-task.
Statuses: Reopened and Open.
Linked issues or subtasks may belong to any project.
This feature will be run as user in field Current user.
I will also added an image of the complete Post Functions on Issue Close
Comments (10)
-
reporter -
repo owner Hi Andre,
i have tried to reproduce your problem but in my case it's working correctly. I explain you my configuration:
- JIRA Workflow Toolbox 2.2.11
- JIRA 6.4.13
- Script Runner 4.1.3.12
My "Close Issue" transition executes the following post-functions:
And the listener implemented with Script Runner is:
Can you please, provide the configuration of the listener you are using?
Have you checked your log file for error messages?
-
reporter Hi,
Yes, I set the Script Runner to debug and I can't find any error in the logs.
I have also asked the Script Runner Vendor for assistance, however they just stopped responding for assistance. You can see the complete thread on Atlassians Answers - https://answers.atlassian.com/questions/38526798/script-listeners---send-a-custom-email.-problem-sending-email.
Here is the condition and screen shots of the workflow.
Condition
issue.labels.any{it.label=='Transfer'} && (issue.isSubTask() && issue.parentObject.subTaskObjects.every { it.status.name == "Closed"})
-
reporter I am also including the Complete Workflow setup. This workflow allows some sub-tasks to be locked from being moved from Open status to any other status, based upon Block and Blocked By links. Unless the previous sub-task is closed, the status cannot be changed from Open. Once the sub-task is Closed, the next sub-task will automatically move from Opened to Assigned.
-
repo owner Hi Hughes,
The problem seems to be caused by the fact that condition is not correctly evaluated by the listener implemented by Script Runner when the post-function is present in the "Close Issue" transition, but I can't find the cause because that post-function is not transitioning issues that are already closed.
I propose you to replace the listener with "Send an email" post-function. If you decide to do it, please observe the following advices:
- Move post-function "Set issue status to the linked status or..." after all the custom post-functions, i.e., to 6th position in execution order.
- Use the following boolean expression in conditional execution parameter:
%{00080} ~ "Transfer" AND %{00041} != null AND count(siblingSubtasks()) = count(filterByStatus(siblingSubtasks(), "Closed"))
Note that:
- %{00080} is field code for Labels
- %{00041} is field code for Parent's issue key
BTW, I think you should remove post-function 5 from transition "Close Issue". It is not necessary, and is confusing.
-
reporter Will the Send an Email post function only send an email on the very last Sub-task that is closed?
The intent was to only send an email if the last sub-task of 17 sub-tasks was closed.
They don't want an email for every one of the 17 sub-tasks that have closed.
-
repo owner Yes, the boolean expression at parameter conditional execution is just for that purpose.
I will also require that the last subtask being closed has a label called "Transfer". I included it since it's also in the listener you had implemented.
-
reporter Cool. I will give that a try.
-
reporter Thank you! This Post function works perfectly. You can close this issue.
Thank you once again for your awesome support .
-
repo owner - changed status to resolved
Great!
- Log in to comment
The Post function in the image is Number 4, with the red arrow.
The Close Issue event is number 10, with the red arrow.