Create automation to populate a date field and write a smart value for certain date format

Brittany Montgomery October 29, 2024

Hello, 

I have created an automation to populate the field "Date Closed" with {{now}} when an item moves to Done status. We want to receive an email when the Date Closed is amended by a user but the automation I have written sends this email when an issue is initially transitioned to Done status (which I don't want) but is correctly sending the email when I manually change the Date Closed field. See first screenshot. 

Additionally, we want the date to be in the format of October 29, 2024 rather than 29/Oct/24 (see 2nd screenshot). Here is the smart value text I use to generate the email in the screenshot:

The Date Closed on {{issue.key}}, {{issue.summary}} has changed from {{changelog.Date Closed.fromstring}} to {{changelog.Date Closed.tostring}}.

Thank you!Value Change on Date Closed.PNG

Email notice.PNG

2 answers

1 vote
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.
October 29, 2024

Hi @Brittany Montgomery 

From what you describe, your first rule triggered on Issue Transition is triggering the other rule when the field is updated.

Please check the details at the top of the rule triggered on the field change as you likely have this option selected / checked and it should not be:

Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule.

 

Next to format the date, you may use the built-in formats or use the format() function for other layouts: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---

 

Kind regards,
Bill

Brittany Montgomery October 29, 2024

Hi Bill,

Thanks for your reply! I unchecked the box on the transition automation and I'm still having the same result where the Date Closed field is empty then I populate with a date but receive an email - see screenshots. Date Closed Email automation.PNGEmail.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.
October 29, 2024

No, you want to uncheck the option on the rule triggered on Value Changes for Date Closed.

 

By the way, that option is disabled by default to prevent looping and other race-track errors.  It is normally only enabled when you specifically want one rule to trigger another.

I recommend reviewing your rules to understand why it was enabled in both rules.

Brittany Montgomery October 30, 2024

Hi Bill, 

This seems to be working correctly! Thank you! 

For the date, I would want to use longDate and tried to plug this into the smart value but it's not working. The automation currently reads:

The Date Closed on <a href="{{issue.url}}">{{issue.key}}</a>, {{issue.summary}} has changed from {{changelog.Date Closed.fromstring}} to {{changelog.Date Closed.tostring}}.

I tried putting longDate in various places within the smart values but no dice.

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.
October 30, 2024

Awesome; I am glad to learn that helped!

When using the changelog smart values of fromString and toString, those are text.  To use the date formatting they must be converted back into a date type first.  For example:

{{changelog.Date Closed.fromString.toDate.longDate}}

Please let me know if that works for you.

Brittany Montgomery October 30, 2024

Hi Bill, 

This worked! Thank you. Is there a way to state the date the item changed to? For example, the item below changed from October 29, 2024 to October 14, 2024. The "to" component would need to be added. 

The Date Closed on RCM-4896, TX Disaster Proclamation Dated 10-16-2024 RE E. Coli in Public Water System in Webb County has changed from October 29, 2024.

I currently have the automation written as:  The Date Closed on <a href="{{issue.url}}">{{issue.key}}</a>, {{issue.summary}} has changed from {{changelog.Date Closed.fromString.toDate.longDate}}.

0 votes
Chi Am _Addon-Solutions_
Atlassian Partner
October 29, 2024

Hi @Brittany Montgomery

On your email sending automation rule, you must deactivate this option

send-mail.png

Chi Am _Addon-Solutions_
Atlassian Partner
October 29, 2024

@Bill Sheboy  beat me to it by giving you the correct answer to both of your questions :p

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events