Automation condition: Compare if lastCommentAuthor == Reporter

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

Accepted Answer
1 vote

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

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 Knecht Community Champion Oct 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

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 Knecht Community Champion Oct 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

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 Knecht Community Champion Oct 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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

34 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you