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?
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
This will do! Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
The second executes the replaceAll on the comment.
I'm just logging the replaced text, but you can use this same smart value to update the custom field.
Hope this helps.
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.