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

How setup an automation with conditionals? 🤔

Dario Alarcón
Contributor
November 7, 2023

Hello community.
I need your collaboration to be able to set up the following automation:
- Trigger: Schedule (daily)
- Action: Lookup issues
- Then: Send a slack msg

The conditional would be that depending on the search result returned by the "Lookup Issues" action, if it is greater than "0" it should send a Slack msg and if it is equal to "0" it should send another type of msg in Slack.

 

JQL CODE:

created >= -2d AND updated <= -24h AND status in ("B2CLOUD INVESTIGATING", PENDING, "WAITING FOR SUPPORT")

 

What is the component I should choose for this to work as desired? FOR EACH Block or IF Block?

Captura de pantalla 2023-11-07 170058.png

1 answer

1 accepted

1 vote
Answer accepted
Michel Neeser
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2023

Hi @Dario Alarcón

You can use an IF condition for this with an IF, ELSE block. Here is a small example:

Automation_-_Jira.png

Hope this helps.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2023

Adding to this...

The above example is not quite correct. The smart value that needs to be used is {{lookupIssues.size}}, not just simply {{lookupIssues}}

Like • # people like this
Michel Neeser
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 8, 2023

@Trudy ClaspillMy example works (I tested it), probably because the lookupIssues object is not even there if the lookup returns no results. But yes, your solution is certainly more elegant. Thank you for the addition!

Like • # people like this
Dario Alarcón
Contributor
November 8, 2023

Hi Guys @Michel Neeser @Trudy Claspill , thanks a lot for your help!!!

That helped me a lot.

 

Now I have the following question, because in the message that I want to send from SLACK it takes the last comment made in the incident, what I need is to place a conditional through the smart values that allows me to "not take the comments made by a user in particular (Automation for Jira)", is this possible?
I understand that I should specify the user ID, but I don't know what the correct statement is to carry out this action. 
This is my code in the slack message:

{{#lookupIssues}}
<https://b2c.atlassian.net/browse/{{key}}|{{key}} &gt; {{summary}}>
{{assignee.displayName}}
{{comments.last.body}}
{{comments.last.author.displayName}}
{{/}}
Michel Neeser
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 8, 2023

@Dario AlarcónYou can loop through the comments of an issue and check for a specific user (e.g. Automation for Jira) like this:

{{#lookupIssues}}
{{#comments}}
{{#if(not(author.accountId.equals("xxxxxx:xxxxxx")))}}
Comment NOT from Jira Automation: {{body}}
{{/}}
{{/}}
{{/}}

However, I am not sure how to only output the LAST comment which is not from Jira Automation. Maybe someone else has an idea?

Like • Dario Alarcón likes this

Suggest an answer

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

Atlassian Community Events