Update summary with updated due date

Kara Cooper April 11, 2023

I currently have subtasks with dates in the summary like this "Attendee analysis (03/29/2024)" using format("(MM/dd/yyyy)")

 

I want the date in the summary to change if I change the due date. For example, if I changed the due date to April 2nd the summary would update to "Attendee analysis (04/02/2024)"

 

I've tried these but with no success:
{{issue.summary.replace("(\d{1,4}([.\-/])\d{1,2}([.\-/])\d{1,4})","duedate.format("(MM/dd/yyyy)")}}

{{issue.summary.replace("(MM/dd/yyyy)","duedate.format("(MM/dd/yyyy)")}}



replaceAll(String regex, String replacement)

Performs a regular expression search and replaces any match with the replacement. $1 can be used to access a matching group in the replacement.

More info on String.replaceAll(String, String)

2 answers

1 accepted

1 vote
Answer accepted
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.
April 12, 2023

Hi @Kara Cooper 

Please try escaping the parentheses around your date in the regular expression.  Like this:

{{issue.summary.replaceAll("(\(.*\))",issue.duedate.format("(MM/dd/yyyy)"))}}

And...because you are replacing the date, there is no need to reference the captured group from the regular expression search.

Kind regards,
Bill

Kara Cooper April 12, 2023

It worked! Thank you!

Like Bill Sheboy likes this
Kara Cooper April 12, 2023

@Bill Sheboy is it possible to write an automation to add the due date to the summary if it was not included initially and I use | as a consistent text separator?

subtask before "Attendee analysis | [Webinar] ABC"

parent task "[Webinar] ABC"

subtask after automation "Attendee analysis (03/29/2024) | [Webinar] ABC"

 

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.
April 12, 2023

Yes, that is possible...Use a similar regular expression in an Advanced Compare Condition to check if it is present/or not...adding when needed.  I recommend using if/else conditions to handle the two cases: present or not.

Suggest an answer

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

Atlassian Community Events