Automation JQL condition: using smart values

Estelle Decanis December 19, 2023

Hi,

When an issue is created, I want to display issues with the same account as the trigger issue.
I'm attaching the documentation on smart values and my automation.

smart values Account.png

 

 

auto.png

 

But the "Validate query" light is not activated.
Any ideas?

Best regards,
Estelle

1 answer

1 accepted

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

Hi @Estelle Decanis 

The "Validate query" feature is only enabled if the JQL can be determined in the rule builder.  Your JQL is based on a smart value, and so cannot be validated until runtime.

I suggest trying the JQL stand-alone (in View All Issues) with a known value for the field, confirm it works, and proceed from there.

Kind regards,
Bill

Estelle Decanis December 19, 2023

Thanks for your answer. I'll try

Kind regards,
Estelle

Estelle Decanis December 20, 2023

@Bill SheboyIf I replace the condition with a value : it works

 

But if I replace by the smart value
2023-12-20_09h10_53.png

it fails :
2023-12-20_09h10_11.png

The same result with :
Account = {{issue.TempoAccountField.name}}
or
Account = {{issue.TempoAccountField}}

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 20, 2023

Progress!  That tells us the smart value is empty, or not available at the time the JQL is used.

Please try writing this to the audit log, just before your statement using the JQL:

This should not be empty: {{issue.TempoAccountField.value}}

Then test your rule and post an image of the audit log.

 

Once possible cause of this: there is a known symptom with the Issue Created trigger that it can fire so quickly the issue data is not yet available for the rule to use.  (i.e., a race-track error)  The result is the rule steps do not work as expected / in a predictable manner.

The work-around for this is to always add the Re-fetch Issue Action immediately after the Issue Created trigger.  This will reload the data before the rule proceeds.  Please try that after the above test.

Estelle Decanis December 21, 2023

if it's correct

2023-12-21_12h24_19.png

 

it doesn't work

2023-12-21_12h24_57.png

 

I try with Re-fetch :

2023-12-21_12h28_09.png

 

2023-12-21_12h31_38.png

@Bill SheboyI must have made a mistake using your instructions

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

Thanks; that rules out a couple of possible causes.  Let's now check if the Tempo documentation is correct...

Automation rules do not support all possible fields.  For example, some fields from marketplace apps are dynamic and may not be supported.

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/

Like Estelle Decanis likes this
Estelle Decanis December 21, 2023

Great !! Thanks !
I fund this :

2023-12-21 182531.png
2023-12-21 180653.png

 

in the Support/Atlassian documentation there was this example:

2023-12-21 180954.png

I set it up with the id of my field

2023-12-21 181024.png

 

There's change :)

2023-12-21 182043.png

it's the name of the center looking for.
It found it, but apparently it's invalid. And the action of the automation doesn't work

Estelle Decanis December 21, 2023

I change the condition :

2023-12-21 183546.png

The center of the trigger issue is identical to that of an existing ticket (this is what I was looking for) :

2023-12-21 183628.png

But it's still marked Invalid JQL :/

Estelle Decanis December 21, 2023

Bingo ! I fund !!

Estelle Decanis December 21, 2023

it's a smart value so the condition shouldn't be "jql" but "smart value" :

2023-12-21 184117.png

 

the action could be done (= link issues) :

2023-12-21 184430.png

2023-12-21_18h46_14.png

Here's the automation :

2023-12-21 184722.png

 

Thank you so much @Bill Sheboy

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

Well done!

And I see why your JQL condition failed: there are embedded spaces (and other characters) in the values.  The fix for that would be to wrap the smart value in quotation marks for the JQL, like this:

Account = "{{issue.customfield_10044.value}}"
Like Estelle Decanis likes this
Estelle Decanis December 22, 2023

Of course !! How could I forget that ?

Thank you so much for yours answers :)

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events