Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Stop Message variable appearing if issuesize is 0

alexanderlanden February 15, 2022

Hello

Currently have a Jira Automation message bot displaying filter data using issuesize and linked to filter
jira auto question.jpg
My question is would there be a way to prevent data from appearing if 0, e.g "No Epic Link" has 0 count above so stop it from showing when 0?

Current string for "No Epic Link" 
<https://filterlink/issues/?jql=filter|*No Epic Link*: {{totalIssuesForTHmvpEpic|0}}>

1 answer

0 votes
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.
February 15, 2022

Hi @alexanderlanden -- Welcome to the Atlassian Community!

Yes, that should be possible using the conditional logic functions for smart values.  Just test if your value is not zero to proceed...or use a greater than test and check that for "true".  Please look here for more information on conditional logic:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

Kind regards,
Bill

alexanderlanden February 16, 2022

Hi @Bill Sheboy 

Ive tried {{#if(and(totalIssuesForTHmvpAssignee.gt(0)))}} and{{#if(totalIssuesForTHmvpAssignee.gt(0))}} but it fails to display if >0.


{{#if(and(totalIssuesForTHmvpAssignee.gt(0)))}}<https://.atlassian.net/issues/?jql=filter%20in%20(%2234161%22)%20AND%20Status%20not%20in%20(Done)%20AND%20component%20in%20AND%20fixVersion%20%3D%20%2220MVP%22%20AND%20assignee%20is%20EMPTY|*No Assignee*: {{totalIssuesForTHmvpAssignee}}>{{/}}

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.
February 16, 2022

What is your field type?  I wonder if you need to convert first with asNumber before the test if the fields are text type...Conditional checks do not work with text fields, I believe.

For example you could try:

{{#if(issue.totalIssuesForTHmvpAssignee.asNumber.gt(0))}}Is greater than zero{{/}}

Please note that you use the {{#if... syntax when you want to return a value (e.g. in my example "Is greater than zero")  and just {{if... when you just want a true/null result...without the pound symbol and trailing {{/}} to close the expression.

alexanderlanden February 21, 2022

Hi Bill 
Still no luck im afraid.

Tried {{#if(issue.totalIssuesForTHmvpAssignee.asNumber.gt(0))}}<https://.atlassian.net/issues/?jql=filter%20in%20(%2234161%22)%20AND%20Status%20not%20in%20(Done)%20AND%20component%20in%20AND%20fixVersion%20%3D%20%22MVP%20(~11th%20Mar)%22%20AND%20assignee%20is%20EMPTY|*No Assignee*: {{totalIssuesForTHmvpAssignee}}>{{/}} and still it fails to appear

Also tried {{if.. but got null error

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.
February 22, 2022

Hi, @alexanderlanden 

First, how/when is that field you are testing in the issue populated?  Are you certain it contains a numeric value when tested?  If you try writing it to the audit log, what does it show?

Next, would you please post images of your complete rule and of the audit log details for when the rule doesn't work as you expect?  That may provide some context for what is happening.

Thanks!

alexanderlanden April 20, 2022

Hi Bill
Sorry for the late reply
ended up with just displaying "0"
Thank you for the assistance on this. 
I have a new question will post shortly.

Suggest an answer

Log in or Sign up to answer