Trigger automation rule by transition instead of status

Sander Voskuilen November 28, 2022

Hi all, 

At my client we like to achieve the following with an automation rule:

We would like to trigger an automation rule based on a self-transition in the workflow. In this case we would like to create a story from a bug, using a self-transition.

For example:

SCR-20221128-l68.png

  • Status: To Do
    • Self-transition: 'Create a Story'
  • Status: Intake
    • Self-transition: 'Create a Story'

This created a workflow button on the top of a bug.

When clicking the 'Create a Story' transition button we would like to trigger an automation rule that will create a new story and link it to the bug.

SCR-20221128-l8n.png

The automation rule is configured as follows:

SCR-20221128-laq.png

This causes the following behaviour:

When the bug in status 'To Do' and you click the 'To Do' workflow status again. It creates a story and links it. We only want to create a story when the 'Create a Story' transition is being used.

Do you guys have any clue on how to configure this?

 

Thanks in advance!

 

 

2 answers

1 vote
Bill Sheboy
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.
November 28, 2022

Hi @Sander Voskuilen -- Welcome to the Atlassian Community!

Your advanced compare is referencing a specific status value's workflow transition in changelog, but I do not believe that is possible yet. They have information at the field level only.  And so those expressions may be evaluating null to null, and so always passing.

There is an automation suggestion to support triggering on specific workflow transitions: https://codebarrel.atlassian.net/browse/AUT-993

A work-around would be to set a field value on that transition in workflow, possibly using a marketplace addon for scripting, and then test for that value in a condition.

Kind regards,
Bill

Sander Voskuilen November 30, 2022

Hi @Bill Sheboy ,

Thanks for reply and mentioning the codebarrel request. I will look into this!

For now I used the workaround to hide the current status the issue is in via a JSU option: value field listed in this article at the bottom: Is there any way to hide current trasition In All-... (atlassian.com)

This way the To Do and Intake status is not visible and this solves my 'problem'.

Thanks!

Like Bill Sheboy likes this
0 votes
Scott Fannen December 12, 2023

Hi there,

I've stumbled across this while looking for something to cure the aftereffect of me "fixing" this ;) (I think this probably helped me with the fix too)

But I'll say how I did it in case it helps someone.

Since Jira Automation's "Transition" trigger doesn't really work on "transitions" but actually works on "change of status", we wanted to have a bunch of Actions (status to self transitions) that would do different things in an automation. 

e.g. 
Create this (do this in an automation
Create that (do that in an automation)
Create something else (do something else in an automation)

Since the Jira automation doesn't SEEM to allow you to read the transition name, and we didn't want EVERY transition in the project to create issues everywhere, I basically set up a menu field with options for every action in the workflow.

When the action was chosen, a post-function in the workflow transition sets the field to the appropriate menu option "Update issue custom field" (where you write the exact field value in the "Custom Field Value" field).

When the transition based automation runs, it will only continue running if the custom field value is NOT "NONE" (so it needs to have that as an available value) or EMPTY (as it may not be set at first).

Then it will do the appropriate automated action based on what that field value is, THEN set the custom field value back to NONE (so the automation won't run again when a normal workflow transition is run, and so you can set off the automation again later if you want to).

So pretty much:

* User makes workflow action choice
* This sets a custom field value in a post function
* This workflow action choice triggers an automation that will only run if the custom value is something that needs actioning
* If the automation keeps running, it will do the desired action, then set the custom field value to NONE to "clean up after itself"

The problem I'm now trying to fix (which isn't that major as these actions have been run for months without noticing this), is we also have automations copying status changes between projects...which apparently copy the "status to self" changes too (sigh) .

Scott 


Suggest an answer

Log in or Sign up to answer