Forums

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

JIRA Automation Email - limit lists based on conditions

Francisco Hazera
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 16, 2023

I am trying to create a weekly status report email that generates a series of lists with issue names and comments segmented by status. I have done it... save for the last part

In the last segment of the lists (the Closed section) I only want to display the items that have been closed in the last 10 days... while in all other sections it is OK to have items that have been open longer than 10 days.

Here is the syntax as it is... the bolded section is where I am having issue.

I can limit based on the status as closed... but I cannot add the second conditional statement.

 

HELP!

 

Syntax:

The Following Candidates have had status changes in the last week:

<b>Resumes In Review<b/>:
{{#Issues}}{{#if(equals(status.name, "In Review"))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

<b>Ready for Interview<b/>:
{{#Issues}}{{#if(equals(status.name, "Interviewing"))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

<b>Ready for C Interview<b/>:
{{#Issues}}{{#if(equals(status.name, "In C Review"))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

<b>Processing<b/>:
{{#Issues}}{{#if(equals(status.name, "In Process"))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

<b>Known Departure Pending<b/>:
{{#Issues}}{{#if(equals(status.name, "Offboarding"))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

<b>Removed from Staff Pipeline<b/>:
{{#Issues}}
{{#if(and(equals(status.name, "Closed"),
(updated,now.plusDays(-10))))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

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.
August 16, 2023

Hi @Francisco Hazera -- Welcome to the Atlassian Community!

In your "closed" section, you do not have a condition which produces a true/false.

What test are you trying to perform for comparing updated and now.plusDays(-10)?  Did you want to use greater than or equal to, gte()?  Please try adding that to observe the results.

And also: in my experience, date/time comparisons like this with smart values need to be more specific.  I recommend you consider using a specific format for both values to ensure they compare as you want, as an alphanumeric text string.  For example, try formatting to jiraDateTime, and perhaps even converting to your own time zone to help with debugging.

Kind regards,
Bill

Francisco Hazera
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 17, 2023

Thanks bill... running into this error with using the GTE function... 

brand new to writing this automation code so any help would be greatly appreciated 

 

Capture.PNG

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.
August 17, 2023

I believe your earlier expression was closer before...perhaps try this:

{{#Issues}}
{{#if(and(equals(status.name, "Closed"), gte(updated.jiraDateTime,now.minusDays(10).jiraDateTime)))}}
<a href="{{issue.url}}">{{Summary}} - </a>{{Comment.last.body}}
{{/}}{{/}}

Suggest an answer

Log in or Sign up to answer