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}}
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.
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")}}
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dailet Hum , can you make something like my screen, it work for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}}?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.