Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use a post function to trigger an automation rule?

Tim H_
Contributor
August 7, 2024

I need to do some rather complex operations in certain transitions, which I can't realize with the built-in post functions. However, I can use automation rules for that. 

Now I'd like to know how I can trigger those rules specifically for those transitions. In Data Center, I don't see the option to use a certain transition as a trigger.

Perhaps webhooks could be a solution? At least, post functions can trigger webhooks and webhooks can trigger rules. Would that be a good idea? I don't really know much about webhooks and how to configure them.

4 answers

1 accepted

3 votes
Answer accepted
Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2024

Hi @Tim H_ 

I haven't utilized webhooks in that manner before, but it should be effective.

Another option is to create a custom field and utilize the Field Value Change trigger.

 

Hope that helps

Best regards

Sam

Tim H_
Contributor
August 8, 2024

Hi @Samuel Gatica _ServiceRocket_,

thank you for your input. I set up a webhook and it worked.

1. Create automation rule that's triggered by an incoming webhook. Copy the respective URL.

2. Add a webhook listener, use the URL and add ?issue=${issue.id}

3. Now I can use the triggering issue inside the automation rule, e.g. in order to copy values from.

1 vote
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2024

@Tim H_ -

In automation rule, you can just use the triggering event of "Issue Transitioned" to conduct your alternative post-function-like operations.  Don't if you already try it or not.

Hope this helps.

Best, Joseph Chung Yin

Tim H_
Contributor
August 7, 2024

Hi @Joseph Chung Yin,

thank you for this idea. There is indeed a trigger "Issue Transitioned". However, I can't select a particular transition. I'd like to select "Workflow A, transition X". That's possible for actions, but not for triggers.

Instead, I can define a "From" and a "To" state. I can't even restrict it to a workflow. Thus, every time an arbitrary workflow that transitions from that state A to B would trigger the rule. I think that's very error-prone and can lead to unwanted effects when creating new workflows.

In my case, it wouldn't even work. I have several transitions from A to B and I want different rules to be triggered, depending on the transition.

Best regards,

Tim

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 8, 2024

A transition is exactly this - an action from state A to state B. even though you can’t choose the workflow in the trigger this could be restricted with either the type of rule (single project) and/or further with condition asking for the issue type. 

Thus it will only run actions whenever the condition is met and makes the rule much easier and a lot less complex to handle and maintain.

Best
Stefan

Tim H_
Contributor
August 8, 2024

Dear @Stefan Salzl,

thank you for this clarification. Unfortunately, I didn't find a way to make this work in cases where I have more than one transition from A to B and I want the rule only to be triggered for one of the transitions.

As you can see above, I found a solution by using webhooks.

Like Stefan Salzl likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 8, 2024

@Tim H_ 

aaaah i see. Thanks for the clarification. Great to know you got the perfect solution for your case (y)

Best
Stefan

0 votes
Tim H_
Contributor
August 9, 2024

Using webhooks to trigger automation rules works flawlessly. However, after reading this document from Atlassian, I wonder if this is a good idea. They say that using webhooks may slow down your system and that webhooks should be avoided if possible.

I was planning to use them as a trigger for automation rules. They should not listen to certain events like issue created, but are called explicitly from a post function.

I wonder...

- if it's a good idea to use webhooks like this from a performance perspective.

- if I could (should?) use custom events instead of webhooks.

0 votes
Jamie Rogers
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.
August 7, 2024

Hi Tim

A webhook post-function is just going to send a JSON payload from Jira to somewhere else thats listening for it - in our org we use these to trigger CI/CD or Ansible to then do builds or run playbooks. I suppose you could have an automation listening for this webhook on the same Jira server but I have not seen it used this way before, so unsure if it would work.

As others have suggested above there maybe be other ways to use automation to update your issues (similar to post function actions) - such as issue transition or field update triggers to start your automation.

Regards, Jamie

Tim H_
Contributor
August 7, 2024

Hi @Jamie Rogers,

thanks for your ideas. As I mentioned in the other answer, the issue transition doesn't work as a trigger. A field update trigger could probably work. But it seems cumbersome and error prone :-(

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.12
TAGS
AUG Leaders

Atlassian Community Events