Posting a comment when task has been in state for a set duration

Nils Medina
Contributor
February 7, 2024

I'm trying to set an automation rule to achieve the following:
WHEN ticket has been in state "Merged/Built" for >48h
THEN post a comment on ticket

I've followed the steps described in this knowledge base article, simply tweaking the last step.

  1. Created a custom field Time in Merged/Built
  2. Set a first automation that sets Time in Merged/Built to {now} when transitioned to state Merged/Built
    aut1.png
  3. Set a second automation that runs every hour for new tickets in the Merged/Built state, which checks if {{Time in Merged/Built.diff(now).hours}} > 48. If true, it posts a comment.aut2.png

However, the comment is never posted.

I made sure that step 2 was working fine, so I suspect that the smart value in step 3 is the issue. I've tried escaping the "/" as you can see in the screenshot but that didn't work.

Any help would be greatly appreciated!

1 answer

1 accepted

2 votes
Answer accepted
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2024

Hi @Nils Medina ,

please try to add the Log action to find out value of your smart value {{Time in Merged/Built.diff(now).hours}}

 

https://support.atlassian.com/cloud-automation/docs/debug-an-automation-rule/

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2024

Hi @Nils Medina ,

also, you are missing word issue in the smart value, it should be probably:

{{issue.Time in Merged/Built.diff(now).hours}}

Like Nils Medina likes this
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.
February 7, 2024

Hi @Nils Medina 

Adding to Hana's answer...

Smart values are name, spacing, and case-sensitive.  And often the smart value does not match the displayed field name on the issue views.  To identify the correct smart value (and custom field id) for any supported fields for automation rules.

The essential steps are:

  • identify an example issue which has your field(s)
  • call a REST API function with a browser to search for your issue:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • search on the page for your field, such as with CTRL-F
    • if you find the field, you will also find the smart value, custom field id, and structure / attributes it has
    • if you do not find the field, it is not supported by automation rules

 

Once you find your field, update your rule condition accordingly and re-test.

 

Kind regards,
Bill

Like # people like this
Nils Medina
Contributor
February 7, 2024

Thank you both, I managed to fix the smart value :)

In the end, the issue was two-sided:

  • as @Hana Kučerová hinted, the smart value needed the issue. prefix
  • as @Bill Sheboy hinted at, the field was called Time in Merged/Built: and not Time in Merged/Built 🤦‍♂️
Like # people like this

Suggest an answer

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

Atlassian Community Events