Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,461,203
Community Members
 
Community Events
176
Community Groups

Compare custom date field in trigger issue to find if other issues have same day in field.

Russell Zera Community Leader Aug 16, 2021

Hello! Not sure how to request this specifically, but I'm looking for some help with a specific Automation challenge I have. I've searched community, the documentation, etc and been unable to find a working solution. Here is what I am trying to do (√ next to steps I know and have working):

  1. √ TRIGGER: When the value of a specific field changes (release type selector)
  2. CREATE VARIABLE:
    1. Variable Name: smartReleaseStart
    2. Smart Value: {{issue.fields["Release Start"]}}
  3. CONDITION: If: Some JQL issues match
    1. Related issues: JQL issues
    2. Related issues JQL: ("Release Start[Time stamp]" is not EMPTY) (THIS VALIDATES PROPERLY)
    3. Condition: Some match specified JQL
    4. Matching JQL: {{smartReleaseStart}}
  4. (√) ACTION: And: Add comment to issue - "Passed"

 

So I recognize that I can't use Smart Values in Related Issue Condition, but I wanted to highlight what I'm looking to do. My automation summary statement of success is the following:
"If a ticket is created as a certain release type, if there are any other issues of the same release type that have "Release Start" occurring on the same date as the newly created issue, Send a message to a channel". 

Right now for this test I just want to get it to create a comment on the trigger issue, I can do all the other connections no problem, but I don't know how to compare date values (I'd love to have other variables that I can tune with later like +/- 2 hours of "Release Start" but for now I think just if it "detects another Release of the same type occurring on the same day, notify the team" is my MVP success criteria.

Thanks in advance for your help!

3 answers

2 votes

Hi @Russell Zera 

Would you please post an image of your rule and the audit log from an execution that doesn't work as you expect?  Thanks!

I have not observed consistent behavior with the related issues condition when there are lots of criteria.  As an alternative, if you can write JQL to perform your test perhaps try a Lookup Issues action and check if the return count is greater than zero.  You would then have the resulting issues if you need to take action/messaging.

  • trigger: field change on release type
  • action: lookup issue on JQL, which matches your release type and release start from the trigger issue.  If you need the comparison range you mentioned, you could use .diff().hours to bracket the value
  • condition: advanced compare on {{lookupIssues.size|0}} is greater than 0
  • action: add your comment

 

Best regards,
Bill

Russell Zera Community Leader Aug 17, 2021

Thanks! Taking a look at this now along with another reply below as well :-) 

Like Bill Sheboy likes this

Hi, @Russell Zera 

I saw your message, and I am unable to jump on a call currently, so I'll try to fill in more details for the Lookup Issues step and JQL...please let me know if this helps.

  • action: lookup issues on JQL, which ignores the trigger issue as you wanted to know if there are *any other issues within a range of the trigger's release start*.  Let's assume a range of +/-2 hours, adjusted with smart value functions.  Also consider if you need more criteria in that query, such as ignoring "done" issues.
key != {{triggerIssue.key}}
AND "Release Start[Time stamp]" IS NOT EMPTY
AND "Release Start[Time stamp]" >= {{triggerIssue.Release Start.minusHours(2)}}
AND "Release Start[Time stamp]" >= {{triggerIssue.Release Start.plusHours(2)}}

Please note that I do not know the smart value for your custom field, such as {{issue.Release Start}} 

If that smart value does not work, you may use the information in this how-to article to find it: https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/  Summarizing those steps you would:

  • Identify an issue which has your field of interest
  • Enter this URL in a browser, changing  myInstance to the one for yours and the issueKey to yours:
 myInstance.atlassian.net/rest/api/2/issue/issueKey?expand=names
  • Search on the page for your field name; this will show the field name, and any custom field ID, if you want to use that instead
  • Search again on the page and you should see the current value in the field; this will help confirm you are looking at what you expected

Hi @Russell Zera 

For comparing date values I have found that trying to match date values is a problem so better to use a range. @Bill Sheboy mentioned .diff() but you could also use 2 advanced compares. Here's one of mine which performs actions on issues which are now at 3 Business Days after a date custom field.

Screenshot 2021-08-17 102207.png

Russell Zera Community Leader Aug 17, 2021

Thanks! Taking a look at this now along with another reply above as well :-) 

Russell Zera Community Leader Aug 17, 2021

This looks like it's checking a set date against the date field in the Trigger or Destination issue to return True/False, vs checking if other issues within a certain group of projects also match the expression/range in their same custom date fields. I am definitely though going to see if I can leverage parts of this, very helpful. thank you!

Not sure what you mean by "I recognize that I can't use Smart Values in Related Issue Condition...", since Smart Values can be used in the JQL field of a Related Issue Condition.

The warning that appears in that dialog is only talking about validating the JQL. Thus, the "Validate query" feature is disabled when the JQL contains a Smart Value. The JQL will still work as written, with any Smart Value substitutions. You just can't validate it on-the-spot in that rule dialog.

Russell Zera Community Leader Aug 17, 2021

Hi there! Thank you for responding. I know that smart-values if used in JQL can't be validated, but I was actually referencing (but I might be misinterpreting) the documentation for "Related issues" condition that says "Use smart values here: No". 2021-08-17_16-55-08.png

If I can use them then great! I guess it's more talking about using them in one of the fields OTHER than the Validating JQL field?  

Mykenna Cepek Community Leader Aug 17, 2021

Neither of the non-JQL fields in this component accept Smart Values.

So I did some tests with smart values in the JQL field of this "Related Issues / Sub-tasks" component.

I started with a pretty dumb smart value, and this JQL worked:

myField > {{#=}} 0 {{/}}

Then I tried this:

myField > {{issue.myField}}

and that also worked. However, my next attempt:

myField > {{issue.parent.myField}}

failed with a rule execution error. The substitution came back blank, causing a missing operand in the final JQL.

So some smart values seem to work. I'd be concerned that we're "outside the bounds of the documentation" here, but you might be able to make some progress working around the edges here.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events