Automation condition: Compare if lastCommentAuthor == Reporter

Chuck Vanderwist October 10, 2017

I have a non-Service Desk project and I'm trying to create some automation to notify/close tickets when the Reporter has not commented on an issue in >3 days.

(If issue was updated >3 days ago and the last comment author is not the reporter, the automation rule should run. If updated >3days ago and the last comment author IS the reporter, the automation should NOT run)

The automation action would be to Send email, transition issue, or add a label, depending on the duration since last updated.

I have Adaptivist ScriptRunner and JIRA Automation plugins.

I've tried creating Automation that uses JQL to determine when the issue was last commented/updated.

I also have a Scripted field that shows the Last Comment Author (using UserPicker filter type), but I can't find any way in JQL/Conditions to compare this scripted field against "Reporter" to see if they equate...

 

1 answer

1 accepted

2 votes
Answer accepted
andreas
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 11, 2017

Hi Charles,

You can do this with Automation for Jira fairly easily I think

So you need a rule like this:

  • Trigger: Scheduled (run once a day) with JQL:
    updated < -3d
  • JQL Condition: 
    reporter != {{issue.comments.last.author.name}}
  • Action: Send e-mail etc

 

For the action part you can split this up further by duration if you use rule branches:

  • Branch action: Current issue
    • JQL condition: updated >= -4d and updated < -3d
    • Action: label
  • Branch action: Current issue
    • JQL condition: updated < -4d
    • Action: send e-mail

So this would label the issue if it's not been updated between 3-4 days ago, and send an e-mail if it's not been updated for longer than 4 days ago.

Hope this makes sense.

Cheers,

  Andreas

Chuck Vanderwist October 12, 2017

Andreas,

I tried your JQL in issue search and I get an error saying that "{" and "}" are reserved characters.

When I use escaping:

updated < -3d AND reporter != \u007b\u007bissue.comments.last.author.name\u007d\u007d

I get this error: The value '{{issue.comments.last.author.name}}' does not exist for the field 'reporter'.

andreas
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 12, 2017

Hi Charles,

So you can only use smart values ('{{' and '}}') in Automation for Jira.  We substitute them with real values when the automation rule executes, but Jira's issue search doesn't understand them directly.

Here's an example rule that should work:

rule-search.png

If you want to test this out in Jira' issue search, you need to substitute an example value for the smart-value:

updated < -3d AND reporter != fred

Hope that makes sense!

Cheers,

  Andreas

Chuck Vanderwist October 16, 2017

Andreas are you sure?

I created the rule exactly as you have shown and I still can't publish it (see the JQL error in my screenshot)

Selection_253.png

andreas
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 16, 2017

Hi Charles,

Looks like you might be running an older version of Automation for Jira, where this wasn't supported yet. What version are you running?

Can you try upgrading to the latest via 'Manage add-ons' in global admin and then try this again please?

Cheers,
 Andreas

Chuck Vanderwist October 16, 2017

Andreas,

I am running 3.4.20 of Automation for JIRA, and I still get this error whenever I attempt to publish a rule with the configuration pictured in the screenshots here.

andreas
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 16, 2017

Hi Charles,

Actually apologies - I gave you slightly the wrong answer before. The smart-value doesn't work directly in the scheduled trigger, since there's no 'issue' in the context yet.

You need to change your rule to this:

  • Trigger: Scheduled with JQL updated < -3d
  • JQL condition: reporter != {{issue.comments.last.author.name}}
  • Action: Add comment

 

Here's a screenshot:

jql-condition-comment.png

 

Sorry about getting this wrong the first time!

So this will work, since for the JQL condition there's now an issue in context, that can be access via the smart-value.

Cheers,

  Andreas

Like Irina_Bel_Stiltsoft_ likes this
Chuck Vanderwist October 17, 2017

It works wonderfully when I tried it as a condition, thanks Andreas!

Suggest an answer

Log in or Sign up to answer