Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,197
Community Members
 
Community Events
168
Community Groups

Automation - Create comment if past specifc time of day

Edited

Tried a JQL statement of {{comment.created.longTime.isAfter(6:00:00 PM GMT)}}

However I get audit log errors that tell me nothing more than
'Action details:
Issue condition
The following issues passed: ticket id'

2 answers

0 votes
bmccoy Atlassian Team Aug 29, 2022

Hi,

I think the problem might lie in your smart value. "longTime" is actually a formatting function so will print the date as a String.  Once it's a string it doesn't know how to do an isAfter date comparison.  I think just removing that will get you what you need.

{{comment.created.isAfter(6:00:00 PM GMT)}}

Cheers,
Brydie

Hi @bmccoy 

Thanks for the response, I will give that a go and let you know if it works.

I was just now having errors with instead trying startOfDay.

Perhaps I am under the wrong impression on how startOfDay works, I looked at the documentation but I didn't see what time startOfDay refers to.

I assume it is the time of 00:00 of the current day, but maybe it instead references the beginning of a work day e.g. 09:00 ?

@bmccoy doesn't look to have worked sadly.

0 votes

Hello @Ben Greene 

Please provide all the details of your Rule.

How are you using that JQL statement?

The log is indicating it found an issue that matches your Condition, but you didn't tell us what the condition is.

Are you expecting some action to be taken against the matching issues? What is the action? Is the action not being taken?

Hi @Trudy Claspill 

Thanks for the reply, yes I am expecting a comment to be made on the issue when the timeframe of the reporter's comment is outside the hours I am comparing to:

 

The comment is not being made and the error just tells me 'issue passed'

Who is the Actor for the Rule? This will be shown on the Rule Details page.

Does that actor have the permissions needed in the project to add comments to the issues.

Can you show the details of the If and Else-If components?

Can you add Log Actions within your If and Else-If branches that will log a message to the audit log? That will tell you which condition specifically has been matched.

Is this the entire rule? Can you show the entire rule?

  1. Actor: Automation for Jira (I've made other rules that comment based on an if else using this actor, the comment appeared just fine)
  2. Yes it does
  3. The if else conditions only include the 1 condition that u can see in the pic I sent before, but will show u a full view nonetheless
  4. Sure here is the whole rule:

    When I tested this rule the reporter was not one of the ones listed, it was a business day & it was outside the hours I specified, so it isn't any of those things.

In the Audit Log you should get an "Issue Conditions" message for each condition that the issue passes.

If the entirety of the Audit Log is

'Action details:
Issue condition
The following issues passed: ticket id'

...then only the first condition (Reporter is not one of) is being met by the triggering issue. The second condition (Created equals a business day) is not being met, so none of the rest of the Rule is being evaluated/executed.

I recreated your rule components, and you can see here that I get two Issue Conditions statements in my log.

Screen Shot 2022-08-25 at 10.43.52 AM.png

So, I know it is getting past those two conditions, but the Status of the rule execution is still "Some Errors". That tells me there is something wrong with the IF component that needs to be investigated.

The Log Action is very helpful to add to your rule to log messages and values into the Audit Log to help you debug the rule. For instance, you may want to add a Log Action immediately after the trigger to log the value of Created so you can see what the rule is comparing to "a business day". And I would recommend you use a Log Action to record the value of {{comment.created.logTime}} so that you can see the value being used in the comparison.

Here I've added that last Log Action I suggested.

Screen Shot 2022-08-25 at 10.48.36 AM.png

Didnt know about this log feature, thanks for the tip!

I've added in a couple logs to check the time and if the isAfter works, I will see what it produces when it next fails

@Trudy Claspill Had a go logging the longTime

 

I also tried removing the longTime argument in case that was the issue, but no dice: 

@Ben Greene 

I tried a couple of things.

Based on the documentation, my first theory was that the isAfter function can't be used to compare just times. The documentation shows that it is being used to compare dates. So I tried first printing the full time stamp of the creation of a comment, and then using that text in the comparison for the next run of the run and without the longTime formatting. That still returned the "some errors" status.

Next I tried using just an explicit date in the comparison. That also returned "some errors".

Looking at the example in the documentation, then compared now to another date/time field in the issue.

{{now.isAfter(issue.created)}}

So I tried that. It still returned "some errors" but I also finally got another message in the Audit Log.

IF BLOCK
No subsequent actions were performed since JQL condition did not pass due to error running JQL:
Invalid JQL: true

That leads me to believe that this comparison can't be used in the JQL for the IF block condition.

At this point I don't know what the solution is to get what you want. If I come up with something, I'll post again.

Like Ben Greene likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

5,012 views 18 31
Read article

Atlassian Community Events