Workflow transition rules vs. workflow-triggered automation rules

kevin_mcnamee January 13, 2021

Hi!

In a workflow I can create rules for Triggers, Conditions, Validators and Post functions. I would like to know where in this sequence do workflow-triggered Jira Automations take place. Specifically, if I create an automation that triggers on "Issue created", is it triggered after all the workflow Post functions are triggered, or earlier?

Cheers,
Kevin

PS. Wouldn't it be nice if workflow-triggered automations showed up in the list of workflow rules?

3 answers

1 accepted

2 votes
Answer accepted
Gareth Cantrell
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.
January 19, 2021

For every transition in a workflow, you will have at least one post-function which fires an event, for example, Issue Created on the create transition and Generic Event for all others unless you modify these.

If you use an "Issue Created" trigger in your automation rule, then it is processed when the Issue Created event is processed in the post function.

If you use an "Issue Transitioned" trigger, then these will be processed when the event post function in the transition is processed.

kevin_mcnamee March 17, 2021

Thanks Gareth,

As a wrote below, apparently the Automation rule is always run after all of the post-functions are executed, regardless of where in the sequence of post-functions the "Fire event" happens. This I have verified with Atlassian in support case JST-627992.

However, the behaviour is ambiguous and I would like to see an explicit explanation of this in the docs.

Cheers,
Kevin

Gareth Cantrell
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.
March 17, 2021

Hi Kevin,

In a Jira workflow, the entire transition is wrapped inside a transaction, which is only committed after the last post function has completed successfully.

In the source code (available if you have a Jira Server license), in the com.atlassian.jira.workflow.function.event.FireIssueEventFunction class, you will see a call to the IssueEventManager.dispatchIssueEventBundleOnCommit() function, which basically will fire all events processed during the transition at the point the transaction is committed.

This is consistent with the behaviour you have experienced.

Cheers,

Gareth

Like Steffen Opel _Utoolity_ likes this
kevin_mcnamee March 17, 2021

Thanks for the definitive answer Gareth!

Cheers,
Kevin

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2021

In my experience it happens after the post-functions. Or well, that's the assumption we're going off of.

You could test it by setting a field value in a post-function, and then log that field value in an Automation rule.

If we're to believe what the triggers say, they fire "AFTER" the event (issue created/transitioned, field changed, etc.), and so the audit logs should show what your post-function set.

If not... then Automation is firing sometime before then, but that would be... weird, and I'm sure we'd see a lot more complaints about it here. :-}

Let us know.

kevin_mcnamee January 17, 2021

Yes, this is a reasonable interpretation. More specifically, I expect that the automation rules listen for events, in this case the "Issue Created event". Still I would like to have this confirmed. I will ask Atlassian support for a definite answer.

Thanks,
Kevin

kevin_mcnamee March 17, 2021

Just finished a discussion with Atlassian support. We set up the following test:

  1. Add a post-function that would "Assign the issue to the reporter" during a transition. The post-function was placed last in the list, after the "Fire event" post-function.
  2. Create an Automation rule that triggered on "Issue updated" and assigned the issue to a different user.

When the issue was transitioned, the issue was first assigned to the reporter and then assigned to the other user, which matches your experience/assumption.

No conclusion can be drawn about a relationship between firing events and the triggering of automation rules.

Still, I think Atlassian could do more to clarify how this works officially.

0 votes
Ravi Sagar _Sparxsys_
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.
January 13, 2021

Hi @kevin_mcnamee 

That's why you also have post functions in the workflow. These happen when the transition has happened. You can see them for a specific transition in your workflow along with their order.

Automation rules are like listeners that can do something based on an event related to issues (created, commented) or other events (version releases). You can use tags in your rules to quickly filter issues that are triggered from issue transition events.

Ravi

kevin_mcnamee January 13, 2021

Hi Ravi!

Are you saying that the workflow-triggered Automation rules occur when the Post function "Fire a Issue Created event that can be processed by the listeners." occurs?

/Kevin

Ravi Sagar _Sparxsys_
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.
January 13, 2021

Automation rules are not really triggered by the workflows only. It is the events like issue creation, transition, edit issues, assignment etc. There are many events can happen without workflows as well. For workflow transitions you can find one essential post function called "Fire a Generic Event.." which can be processed by the listeners.

kevin_mcnamee January 13, 2021

Yes. This is all useful information, but it does not really answer my question unfortunately.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events