Forums

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

How to remove a specific number of characters from Summary?

Gregory Kremer
Contributor
December 11, 2023

Hello all,

Could someone please provide a smart value for removing a specific number of characters from the Summary. We prefix our Summary with a date. For example "2023-12-01 - Testing security vulnerability". I need to remove the "2023-12-01 - " prefix if this date is updated to NULL. In short, I'd need to remove first 13 characters from the Summary. I'd greatly appreciate your help.

2 answers

0 votes
Laurie Sciutti
Community Champion
December 11, 2023

Hi @Gregory Kremer ~ you can achieve this several different ways.

I'm sure there are more...

Gregory Kremer
Contributor
December 11, 2023

Laurie, Shawn,

Unfortunately {{issue.summary.right(11)}} didn't work as expected (sorry I needed to remove first 11 characters, not 13 as initially stated). It left last 11 characters from the right to left, instead of removing first 11 characters. Here is from the test issue History:

Automation for Jira updated the Summary 15 minutes ago

2023-12-15 Testing Please Ignore -> ese ignore

 

I'd appreciate additional suggestions. Thank you.

Laurie Sciutti
Community Champion
December 11, 2023

Hi @Gregory Kremer ~ that's strange.  Is the date portion of the Summary being set through some other automation that makes it unavailable when you run this automation?  What happens when you try the {{issue.summary.remove("2023-12-01 - ")}} option?

Shawn Doyle - ReleaseTEAM
Community Champion
December 11, 2023

I also suspect another automation is prepending the timestamp to the summary.

Like Laurie Sciutti likes this
Gregory Kremer
Contributor
December 11, 2023

Unfortunately, the prefix (date) is fluid and would be different for each issue, thus I can't hardcode it. I have another automation in place that places a prefix of that date to the summary on issue creation only. I am positive that that automation wouldn't interfere with the one in question, because this one is being triggered on issue edit only.

So here is what I have in place:

Automation that prefixes a value from a date field (SLA Target Date) to a Summary during an issue creation only, if this field is not empty. This part works as expected.

The automation I need your help would kick in on issue edit, when a date field is cleared by user(s) (Null value). In this case I'd need to remove prefix from the Summary.

There are no more automations in place.

Thank you both for your assistance. I hope you would have additional suggestions.

 

P.S. Just for the sanity check, I've disabled the "on creation" automation rule. Sorry to say, the {{issue.summary.right(13)}} still leaves 13 characters from the right.

Gregory Kremer
Contributor
December 11, 2023

OK, I figured it out. Needed to use this smart value:

{{issue.summary.substring(13)}} to remove first 13 characters.

 

Thank you for trying to help. It is always greatly appreciated.

Like # people like this
Laurie Sciutti
Community Champion
December 11, 2023

Hi @Gregory Kremer ~ scratching my head trying to figure out why the right(13) isn't working properly.  Lets try a different approach:

 

{{issue.summary.substringAfter(" - ")}}

 

The above smart value assumes that the format of your Summary is [date] - [summary] so unless you have space dash space (" - ") elsewhere in your Summary it will always returns the text after the first occurrence of the space dash space (" - ").  HTH

ref:  https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#substringAfter--String-separator- 

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.
December 11, 2023

Hi @Gregory Kremer 

Yes, and...to what Laurie was wondering on the text functions did not work as expected:

Context is important for automation rule questions.  To help, please try to post an image of your entire rule, images of the relevant trigger / actions / conditions / branches, and of the audit log details.  Those will show what you are describing in the context of the entire rule.  Thanks!

Kind regards,
Bill

0 votes
Shawn Doyle - ReleaseTEAM
Community Champion
December 11, 2023

{{issue.summary.right(13)}}

This will give you everything in summary after the 13th char.

Suggest an answer

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

Atlassian Community Events