Forums

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

Copy last comment to custom field, limit to 200 Characters and add link to issue

Susan Cain January 22, 2025

Hi, I was able to create a custom field to copy the last comment made on the issue to the field.  However I continue to get an error 

 

(Current Status can't exceed 255 characters (customfield_10183))

I am trying to limit the returned value to be the first 200 characters and return a message at the end of the text when it is over 200 characters.  

So far I only have this code.

{ "fields": { "Current Status" : "{{comment.body}}" } }

2 answers

2 accepted

3 votes
Answer accepted
Mikael Sandberg
Community Champion
January 22, 2025

Hi @Susan Cain,

Welcome to Atlassian Community!

You can limit the comment by adding this to the end of it: .abbreviate(200)

This will limit it to the first 200 characters. 

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.
January 22, 2025

Hi @Susan Cain -- Welcome to the Atlassian Community!

Adding to Mikael's suggestion...

Comments may contain special formatting, mentions, etc.  If you want to parse that out (such as converting mentions from ID values to display names) consider adding text conversion to your field before abbreviation.

For example:

{{comment.body.text.abbreviate(245)}}

Kind regards,
Bill

Like Mikael Sandberg likes this
0 votes
Answer accepted
Susan Cain January 22, 2025

This is what I ended up with.  Thank you for your expedient assistance! 

{ "fields": { "Current Status" : "{{comment.body.abbreviate(245)}}" } }

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