How to test custom field value in Jira Automation

Calderara Serge May 2, 2022

Dear all,

I have the following JQL condition in a automation rule

O5SVopLtgC.png

As you can see above, the no match condition is checking the existance of a linked issue where summary contains the selection of the custome field list string value

The used, of it is that if the linked issue exist, It should not created a linked issue of same summary staring

 

In sample below, the parent issue custom field is defined as "Agence Additionnelles"

FsbaDhoBh8.png

As you can see from the Issue Liknked, it has created ducplicated linked issue. The goal of my JQL condition is suppose to guaranty only one single entry with same summary string

But this is not working, any idea about the syntax to be used ?

regards

1 answer

1 accepted

1 vote
Answer accepted
Garrett McCreery
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.
May 2, 2022

Hello Calderara

I am assuming your custom field is a single select (not a multi-select). 

If that's the case then the smartvalue syntax would be:

{{issue.mycustomFieldName.get(0).value}} 

Garrett McCreery
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.
May 2, 2022

the .get function gets the index of an array. So "0" is the first index.

Calderara Serge May 2, 2022

Thnaks for your reply @Garrett McCreery ,

I have change the rule condition as you sugest as it is a single list select but it does not work either.

As you can see from the picture below, I have select for instance M-Cube in the list and the corresponding issue should have been created as it is not existing yet but it does not ?

Any idea ?

PS : Note that I am on Data Center version

Garrett McCreery
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.
May 2, 2022

After your automation step of "If: Agence Additionnelles is not empty", can you log the value, so that we can see what the value is coming back as?

screenshot.png

Calderara Serge May 2, 2022

Hello Here is the log capture

ZXiKVACHf3.png

Field log is reported as empty

Garrett McCreery
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.
May 2, 2022

Instead of displaying what I sent, please try logging:

{{issue.Agence Additionnelles}} 

Calderara Serge May 2, 2022

Hello, I get it to work by using the following syntax :

summary ~ "{{issue.fields.Agences additionnelles.value}}"

Like Garrett McCreery likes this
Calderara Serge May 3, 2022

hello @Garrett McCreery , I still have a wierd issue

I have add as log in my Automation rule the field {{issue.fields.Agences additionnelles.value}} which return the correct value

But this condition below in my rule

summary ~ {{issue.fields.Agences additionnelles.value}}

Which should says that if summary field contains the custome field valule, then it should not create it but it is creating them, seems the condition is wierd or not working

For exemple below, it has created the M-CUBE linked issue while it was already existing

cisTbLct3u.png

5fYkTmIYVK.png

Any idea what is wrong ?

regards

Calderara Serge May 3, 2022

argggggg, white space leading

Garrett McCreery
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.
May 3, 2022

Do you know how to remove that? just use .trim() on the end.

Like AEMPS likes this

Suggest an answer

Log in or Sign up to answer