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

How can I use {{smart values}} condition?

Dailet June 13, 2024

I'm in the process of setting up an automation rule that will be triggered when a comment is the primary action. To give a clearer picture, I aim to create an automation that will, upon the creation of a comment, consider the author of the comment, the status of the issue, a specific text within the comment, and the date when the comment was created (emphasizing the creation date as opposed to updates). Following these criteria, I intend to assign a user and modify other fields in the issue.

 

Here's an example scenario: If a comment is created between "2024-06-10T00:00:00" and "2024-06-15T00:00:00", is authored by User1, contains the phrase "migrate it", and the issue's status is In Progress, then I want to assign that issue to UserX.

 

When selecting the condition type, I noticed the option to use "{{smart values}} conditions. The benefit of using smart values is that I can access:

- {{triggerIssue.comments.created}}

- {{triggerIssue.comments.body}}

- {{triggerIssue.comments.author.displayName}}

- {{triggerIssue.status.name}}

2024-06-13_103949.jpg 2024-06-13_102858.jpg

I have tried various options for the values in the first and second positions, but my query is still not working bc the conditions are not matched.

 

2 answers

2 accepted

0 votes
Answer accepted
Duc Thang TRAN
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.
June 13, 2024 edited

Hello @Dailet 

Do your ticket have more than 1 comment ? 
If is the case, can you try with {{issue.comments.last.body}} {{issue.comments.last.author.displayName}} etccc ?

and for date 

{{triggerIssue.comment.last.created.format("dd/MM/yyyy")}}

2024-06-13 16_59_37-Audit log - Automation - Scrum03 - Jira.png

Dailet June 13, 2024

ok, let me try that

Dailet June 13, 2024 edited

I udpated my smart values condition for  {{triggerIssue.comment}} to

{{triggerIssue.comments.created.format("dd/MM/yyyy")}} for both conditions, greater than and les than and it worked!

2024-06-13_111836.jpg


but I'm still struggling with the smart values conditions that I'm comparing against strings, like  {{issue.comments.last.body}}, {{issue.comments.last.author.displayName}} and {{triggerIssue.status.name}}

 

Any recommendation with those?

I changed them to {{issue.comments.last.author.displayName.equals("User1")}} equals true but that didn't work

2024-06-13_112309.jpg

Duc Thang TRAN
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.
June 13, 2024 edited

@Dailet  Hum , can you make something like my screen, it work for me 

2024-06-13 17_50_53-Window.png

Like • Dailet likes this
Dailet June 13, 2024

mmm... I should remove the double quotations "" then... ok, I'll try

Dailet June 13, 2024

it worked!!! Thanks @Duc Thang TRAN 

0 votes
Answer accepted
Dick
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.
June 13, 2024 edited

Hi Dailet, welcome. 
The stuff in quotes is a string, the smart values in your comparison are dates.
you must compare apples to apples, otherwise both comparisons give a "false" result, which means the rest of the code is not executed. 

You would need to convert the string to a date(-object)

More on entering your own dates and convert those to Automation dates is written in Converting string to date object with Automation

 

or vice versa:

More on this can be found on the Atlassian smart values page on date and time 

Dailet June 13, 2024

Ok... this means that if I want to trigger an action only if the comment was created after june 10th, 2024 then I must convert "2024-06-10" into a jiraDate?

Like this {{2024-06-10.jiraDate}}?

Dick
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.
June 13, 2024

best convert the object to a string with a suitable format which you choose, then match the date-string you want to compare it with in similar format. 

Like • Dailet likes this
Dick
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.
June 13, 2024 edited

you can define your string in a variable Automation object:
{{comparisondate}} = "2024-04-10"

(the code for entering april 10th ^^)

then convert it to a real date object with the {{comparisondate.format("yyyy-MM-dd")}} command.

Like • Dailet likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events