Can you remove images entered into a custom field via automation?

Philip Ng
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2025

I have an automation setup to copy the latest comment into a custom field. However, sometimes users are entering images into the comment. I do not want the image to be copied over to the custom field. 

 

Is there any function I can add to my automation or create a new automation to remove images that are added into the custom field?

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.
February 21, 2025

Hi @Philip Ng -- Welcome to the Atlassian Community!

You could try the text function to remove all of the markup, including attachment images:

{{issue.comments.last.body.text}}

This will also convert any mention markup into just the display name of the users.

Kind regards,
Bill

Philip Ng
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2025

This will do! Thanks

Like Bill Sheboy likes this
1 vote
Derek Fields _RightStar_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2025

@Philip Ng Welcome to the community!

You can do this in an automation using smart values. A image in a comment has as specific pattern that looks like this:

!<filename>|width=NN,height=NN,alt="<alt text>"!

You can use the replaceAll function with the pattern "\!.*\|.*\!" to remove all instances of tihs block from the comment. 

In my testing I found that I had to first convert the comment to a text string and then run the replaceAll

I have two actions in my test automaton. The first creates a variable from the latest comment. 

Snag_5fc1dcd.png

The second executes the replaceAll on the comment. 

Snag_5fdc92b.png

I'm just logging the replaced text, but you can use this same smart value to update the custom field.

Hope this helps.

 

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