I have 2 workflows with the same transitions (Ready for Work) and statuses (In Progress). Each workflow has a post function.
Looking at the logs, I noticed that when I go through the workflow of one, both scripts are run.
Do I have to create a new status for one of the workflows when I need to run a script?
Thanks,
Martha
I wonder if by copying a workflow, the postfunction script unique ID is replicated in the new workflow.
This could cause the logs from one workflow's execution to be displayed in both workflow.
But I doubt the workflow actually executed twice. You could confirm this by adding some logging to the script to output which issue it was run on and some other random number (.eg.
log.info "This script was executed for $issue.key. RandomUUID to verify uniqueness of execution: ${UUID.randomUUID().toString()}"
To fix this, delete your post-function and re-create it.
This would warrant a bug report to adaptavist.
I realized that for that particular post function, I had repurposed a copied one. New post functions I created didn't show the same problem. Once I deleted it completely and recreated it, the log problem stopped. So yes, apparently the script ID was retained when the workflow was copied. Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @mf - Welcome to the Atlassian Community!
Can you provide some more details about the "script"? Are you using an Automation For Jira rule? A ScriptRunner script? Etc.
Where is the "script" placed? Can you share it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John,
The ScriptRunner script is in multiple workflow post functions. the function iterates a field that has a list of projects and creates an Epic in each of those projects.
Below is a screenshot of the list of ScriptRunner Post functions. You can see in the history that the scripts all ran at the same time. Each one is in a different project and different workflows. It appears if I use the Ready for Development (81) transition in multiple places, when it is run for 1 workflow it is run for all workflows with Ready for Development transition.
Also - I am working in the cloud version.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm running Data Center 8.20.13 and seeing the same thing. I copied a workflow shared across many projects and put the copy in a workflow scheme for a single project. I added a ScriptRunner "create a sub-task" post condition to one transition in the copy, triggered off of a checkbox field specific to that project. Now the execution history for that post condition on the copied workflow shows log entries for the original workflow and that transition ID. They are all green checks and ScriptRunner says "No failures in the last 15 executions", but they all say "ERROR [utils.ConditionUtils]: Workflow condition script has failed on issue... java.lang.NullPointerException: Cannot invoke method contains() on null object"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.