Hello everybody,
I have following problem and struggle with a solution:
We use JSM as Ticketing System, and we have functional interface to the customer ticket system (with JIRA globale automation and it works with SOAP/REST )
The problem is, i can transmit the attachments in JSM to the external system, but the automation rules everytime transmitt every attachment several times.
How can I ensure that each attachment is only transferred once?
Do you have any suggestions to me?
I have already implemented the attachment ID being stored in a custom field. However, I am unable to compare the values and then use them to build a conditional rule.
Thank you very much,
BR
Clemens
Hello Clemens,
You've run into a common challenge, and your idea of storing the attachment IDs in a custom field is a great start!
The core best practice here is to have your rule loop through all attachments but only act on the ones it hasn't "seen" before.
Here is the simple, standard Atlassian-approved way to build this.
Trigger: Field Value Changed
For the "Fields to monitor," select Attachment. This rule will now run only when the list of attachments changes.
Condition: User condition
To prevent the rule from triggering itself in a loop, add this condition:
Set "User who triggered the event" is not "Automation for Jira".
Action: Branch rule / related issues
In the "Type of related issues" dropdown, select Attachments. This is the key step. It will make the rule run the following actions once for every attachment on the issue.
Inside the Branch: Advanced compare condition
This is where you check your custom field.
First value: {{issue.YourCustomFieldForIDs}} (e.g., {{issue.ProcessedAttachmentIDs}})
Condition: does not contain
Second value: {{attachment.id}} (Inside a branch, {{attachment}} refers to the single file for that loop).
Action: Send web request
Place your SOAP/REST action here. It will only run if the condition above is met (meaning the ID is new).
You can now safely use smart values like {{attachment.filename}} and {{attachment.content}} to send the new file.
Action: Edit issue
This is the last step. After you send the file, add its ID to your field to mark it as "processed."
Field to edit: ProcessedAttachmentIDs
Value: {{issue.ProcessedAttachmentIDs.withDefault("")}},{{attachment.id}} (This appends the new ID to the list).
This method is the most reliable way to ensure every attachment is processed exactly once.
For more details on the components, here is the official documentation:
Jira automation triggers (See "Field value changed")
Automation smart values - issues (See the section on {{attachment}})
I hope this helps you get it working!
Hi,
thank you for your answer, looks very good - BUT: i cannot select Attachments in the "Type of related issues" dropdown. I don't have this as an option.
BR
Clemens
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.