Jira Automation - Regex Not Working for Deleting Attachments

adam_carter
Contributor
June 2, 2023

Hi there,

Hope somebody can help as I am struggling to get an automation to work. It's not a particularly tricky one; when an issue transitions to done, if a certain field is not empty, delete all attachments that start with the string "Data Privacy".

JiraAutomation.PNG

Automation triggers fine, if condition matches but the attachments are not deleted.

I've tried variations of the regex as I am not a regex master by any stretch but online tools suggest they would all work:

  • "^Data Privacy*"
  • "Data Privacy*"
  • Data Privacy*
  • Data*

I've output the names of the attachments in a comment using another Jira automation to try and prove that the automation is seeing the filenames as I see them:
JiraComment.PNG

I've set the rule to delete all attachments instead and that did work.

Here's the audit log of the last run:
JiraAuditLog.PNG

Any, and all, help greatly appreciated.

Many thanks

1 answer

1 accepted

1 vote
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2023

My guess it that the regex for the file name needs to match the whole name, so try using this one and see if it works:

Data Privacy.*

adam_carter
Contributor
June 5, 2023

That did it, thank you Mikael!!

Like Mikael Sandberg likes this
Jeremy Drexler November 1, 2023

@Mikael Sandberg looking to do something similar where we automatically delete .har files on ticket resolution in response to Hackers Stole Access Tokens from Okta’s Support Unit – Krebs on Security 

Also not a regex expert ... but our expectation was that this would work: \.har$

Any suggestions?har deletion rule.PNG

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2023

@Jeremy Drexler It looks like the delete attachment step is not converting the $ regex correctly. I just tested and .*.har seems to work.

Jeremy Drexler November 2, 2023

It does! Thanks Mikael!

Like Mikael Sandberg likes this

Suggest an answer

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

Atlassian Community Events