Different Workflows with same tranistion/status run both scripts on transition

mf
Contributor
November 17, 2020

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

2 answers

0 votes
Peter-Dave Sheehan
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.
October 26, 2023

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.

Dan Panachyda October 30, 2023

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!

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 17, 2020

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? 

mf
Contributor
November 17, 2020

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.

 

ThanksWorkflow2.pngWorkflows.png

Dan Panachyda October 26, 2023

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" 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events