Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.
×I have a use case where I want to replace the date in a summary with the date from a date field in the same issue. I have a not-quite-working automation, with help from @Bill Sheboy here: https://community.atlassian.com/t5/Jira-questions/Update-summary-with-updated-due-date/qaq-p/2329197
But, the regex of (in the example linked post)
{{issue.summary.replaceAll("(\(.*\))",issue.duedate.format("(MM/dd/yyyy)"))}}
doesn't quite work and my date format is yyyy-MM-dd and despite changing the regex in the replaceAll to
{{issue.summary.replaceAll("(-(.*-))",issue.customfield_15528.format("yyyy-MM-dd"))}}
the summary of "2024-11-20 Summary text" here gets replaced with "20242024-11-21y text" with the new date being 4 characters out of place to the right and overwriting half of the date and some of the summary text.
I cannot seem to get the regex in the replaceAll working properly.
I fixed it by completely replacing the Summary field from the available fields in the issue instead.
{{issue.customfield_15528.format("yyyy-MM-dd")}} Summary Text
Such a simple idea, i dont know why i was trying to replace the existing Summary! Jut completely overwrite :)
I think you might miss a ( in the smart value clause, in front of yyyy.
I see 4 ( opens and 5 ) closers in your value.
{{issue.summary.replaceAll("(-(.*-))",issue.customfield_15528.format("(yyyy-MM-dd"))}}
Could it be the missing (?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think I may have worked it out. The replaceAll is replacing the contents of everything between the brackets - in the original case (30/10/2024), as this is the
(\(.*\)
part in the regex. In my example I mistakenly misread the slashes and changed the characters to recognise for the replace. In this case i put in the - to replace contents between. So, this is why I got 20242024-11-21, as it replaced the - with the date i extracted from the field.
As I don't have any identifier characters to start the insertion point, it would be ok if it just overwrote the date at the beginning of the Summary. Need to work out how to do that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.