Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Need to shorten the text length in the slack message that is posted via JIRA Automation

Rakhesh Mohan June 27, 2023

HI Team,

I have created an automation where a slack message will be sent in a channel whenever a new comment is added in JIRA ticket. The message that is posted in slack consists of ticket id, summary and the comment added in the ticket.

Problem:

If the comment posted in the ticket is too long, the slack message as well is very long and is not user friendly. So I need to introduce a "read more" link after , lets say 150 characters, and if the user click on the link from the slack, he/she will be redirected to the JIRA ticket.

Screenshot 2023-06-27 at 21.01.36.png

Can someone assist me on how to achieve this please?

1 answer

1 accepted

0 votes
Answer accepted
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 27, 2023

Howdy @Rakhesh Mohan ,

The abbreviate function should help here. This is an example of your comment section with the abbreviate function trimming it to 150 characters:

*_Comment details_* :speech_balloon:
`{{comment.body.abbreviate(150)}}`

If the comment is longer than the 150 characters, the function will add '...' at the 150th character. Otherwise, it doesn't add dots.

Since you have the ticket URL right under the comment section anyway, I'd suggest relying on that as the link to the ticket. Otherwise, you'd need to do some extra comparisons to check if it was over the length, create some variable (in a previous automation action), and include that variable after the end of the comment. Seems reasonable enough to cut it off at the length you decide and call it good.

Cheers,
Daniel

Rakhesh Mohan June 30, 2023

Thanks Daniel for the inputs

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events