Automation to send email 7 days before field date

Fraser Stewart April 26, 2024

I am looking to create an automation where is checks all issues within in project and sends an email for each issue to the requestor warning custom field "Contract End" is in 7 days.

So far I have a schedule set to run every day at 8:00

Then: Lookup issues - project = "projectname"

If: {{Contract End}} less than {{now}}(-7d)

Then: Send Email - using smart values in subject and body {{issue.key}} and {{issue.Employee Name_Starter}}

The email is sending and the written text is coming through but the smart values are blank?

2 answers

0 votes
Dick April 26, 2024

Hi Fraser,
In the if statement you're not referring to any issue at all. So it compares null to a date.

you should have

if {{lookupIssues.Contract End}} less than {{now}}(-7d)

to include the looked-up issues in your if statement.

 

More on the power of smart values with lookupIssues on this page

Fraser Stewart April 26, 2024

Thank you and I have changed the If to include your changes. I have run the automation and the email has come through but the smart values are still missing?

Dick April 26, 2024

if contract end is a custom field, you should lookup its ID first, then use:

if {{lookupIssues.customfield_123456}} less than {{now}}(-7d)

Dick April 26, 2024

if you use the search for issues menu command, the customfield (cf_) id is visible when you enter part of the fieldname in the querie space.

Fraser Stewart April 26, 2024

I have changed to the custom field ID and run. The email has come through but no smart values again I am afraid?

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2024

Hi Fraser - Welcome to the Atlassian Community!

The {{issue.key}} should be working with no problems. 

For the other field, try: {{issue.Employee Name_Starter.displayName}}

The real question is, are there really any issues that are meeting the query. 

So, run the query separately in the search function to be sure there is an issue that should send an email. Then run the rule manually to see what it sends. 

Fraser Stewart April 26, 2024

I have used the query in the main search function and returns no results. Strange thin though is that when I trigger the automation manually an email is sent just with the smart values missing.

Am I doing something wrong with the query?

Fraser Stewart April 26, 2024

I should also have said thank you for the welcome and the assistance :) 

Suggest an answer

Log in or Sign up to answer