Automation JQL condition: using smart values

Sofia Quintero October 11, 2021

Acording with the documentation, Automation JQL condition suport smart values.

How do i set de following condition?:

Find issues that have the same custom field date as trigger issue.

no title.png

2 answers

1 accepted

1 vote
Answer accepted
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.
October 11, 2021

Hi @Sofia Quintero 

Your image appears to show too many curly-brackets around the value.  Please try just two around each side:

{{triggerIssue.customfield_10043}}

Of note: what is the type of your field?  If it has a time you may need to strip off the time part for the comparison by changing the format:

{{triggerIssue.customfield_10043.jqlDate}}

Kind regards,
Bill

Sofia Quintero October 11, 2021

Thank you @Bill Sheboy  for answer,
The custom field is a Date Picker type.

I´ve tried with both format that you mentioned:

no title.png

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.
October 11, 2021

Thanks, Sofia.  What that error tells me one of three things is happening:

  1. The rule is running too quickly after the issue is created,
  2. The field is empty, or
  3. That is not the correct custom field id for the field you want.

Let's try this: immediately after your trigger, add two things:

  • action: Re-fetch issue (This will slow down the rule by reloading the newly created issue, as all of the data may not be ready when the rule runs.)
  • action: log to the audit file this value:
Checking {{issue.key}} for custom field = {{triggerIssue.customfield_10043}}

a) If the rule works after adding the re-fetch, the cause was #1

b) If the audit log does not show your date, it is either #2 or #3

Like Bogdan Gorka likes this
Sofia Quintero October 11, 2021

Thank you very much @Bill Sheboy !!!

You were right, the rule was running too quickly, so the field was empty.
I modify de trigger to give it time, and got the result expected.

Thank you!

Like Bill Sheboy 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.
October 11, 2021

Awesome!  I am glad that helped.

Like Sofia Quintero likes this
Bogdan Gorka
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, 2021

Hello @[deleted] 

Your thorough reply here helped me in a completely different use case.

In my use case I am receiving data from an API interface and the problem is that my automation is executed based on the transition and later there are a few branches, where one of them is selected based on some value in a custom field.

The problem with the interface was, that it worked in two steps - first the re-open transition and then the update of fields. As a result of this design, the automation got initiated while triggered by a transition, however the data needed for the automation could not be yet updated.

With the 're-fetch issue data' action (which I seldom use), I noticed that this can put the automation execution on-hold for the whole 5 seconds! This is more than enough for the interfce to update the issue over API and when it is finished, my automation will jump in and continue. Wonderful :)

Screen 1

temp 2.png

Screen 2

temp.png

Like Bill Sheboy 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.
October 12, 2021

Hi @Bogdan Gorka 

I am glad to learn that helped you.  And...it appears you are using Server/Data Center version, as the Re-fetch action does not have the "delay rule" option for Cloud.

Instead using Re-fetch for Cloud slows the rule for about 1 second (or more).  I recall there are suggestions in the backlog to add "wait until the prior step finishes" or "delay X seconds" actions.

Kind regards,
Bill

0 votes
Estelle Decanis December 19, 2023

Hi @Bill Sheboy I hope you can help me.

I have a case similar to Sofia's but in "if : Issue match JQL" I want to search for issues that have the same Account as the trigger issue. Apparently the smart value must contain {{issue.TempoAccountField.value}} but I can't write a correct condition.

Kind regards,
Estelle

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.
December 19, 2023

Hi @Estelle Decanis 

For older threads like this, I recommend creating a new question and linking back to the older one.  Otherwise only the people following it will see your question to offer suggestions.  Thanks!

Would you please post an image of your complete automation rule, the details of the condition with your JQL, and the audit log details showing the rule execution?  Those will provide context for your question.  Also, what version of Jira are you using: Cloud, Server, or Data Center?

Until we see those...

Smart values are name, spacing, and case-sensitive.  And often the smart value does not match the displayed field name on the issue views.  The how-to article below helps to identify the correct smart value (and custom field id) for any supported fields for automation rules.  The essential steps are:

  • identify an 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

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Kind regards,
Bill

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer