Forums

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

The Field value changed trigger does not work for some fields - workaround

TL;DR: It occurs that Field value changed trigger does not work with some for some fields like attachments, time tracking or log work when you add it via comments. I created a workaround based on Automations. Below you can find how it is possible.

 

My case:

I'm building an integration between Jira and external (non-Atlassian) tool based on webhooks. I used for that built-in webhook feature and it works almost for every action in Jira. Almost... It find out that, for attachments added to tickets, webhook is send to external system but it contains info about attachment without small detail about jira ticket. In other words it inform external system that new attachment is added to Jira but it don't say in what ticket. 

As a workaround I create an automation rule like below:

  • Rule trigger - Field value changed

    • Fields to monitor for changes - Attachment
  • Create variable to get attachment ID

    • {{fieldChange.to}}

  • Get details about attachment based on ID via Send web request and Jira Rest API
  • Send custom webhook (attachment data and ticket key and id) via Send web request

It is working great but during test I found that for attachments added directly in a comment automation rule is not triggered. 

I asked Atlassian support about that and they informed me about this bug - https://jira.atlassian.com/browse/AUTO-382

 

Solution:

Based on above I decided to create next workaround with Automation rules. My solution:

  • Rule trigger - Issue commented

  • Condition - Smart Values Condition

    • First value - {{triggerIssue.comment.last.body}}

    • Condition - contains regular expression

    • Regular expression - \.(txt|jpg|pdf|gif|png|csv|docx|pptx|jpeg)

  • Create variable to get attachments filename

    • {{triggerIssue.comment.last.body.match("(alt=.*)").substringBetween("alt=\"","\"!")}}
    • variable name: attachmentsInComment
  • Create variable to create regular expression with filenames
    • {{attachmentsInComment.split(", ").join("|")}}
    • variable name: varAttachmentsInComment
  • Advanced branching
    • Smart value - {{issue.attachment}}
    • Variable name - issueAttachmentList
    • Condition - Smart Values Condition
      • first value - {{issueAttachmentList.filename}}
      • condition - contains regular expression
      • Regular expression - {{varAttachmentsInComment}}
    • Create variable to get attachment ID
      • {{issueAttachmentList.id}}
    • Get details about attachment based on ID via Send web request and Jira Rest API
    • Send custom webhook (attachment data and ticket key and id) via Send web request

 

Now I need to thanks @Bill Sheboy about his valuable tips here and his awesome article.

Hope that this will help some of you :)

1 comment

Jack Brickey
Community Champion
March 10, 2025

Thanks for sharing @Sebastian Krzewiński . You might want to move this to Jira Articles collection rather than questions.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events