The 'Copy / Move Attachments' feature is available from JSU 2.9.0
This post function will copy attachments from/to all related issues.
A user defines which issue should be a source and which a destination.
Any number of attachments can be copied to the related issue/-s.
There are several ways in which preconditions can be evaluated in the context of a post function:
- Ignore precondition (By default every precondition is ignored. It means that post function will be always performed)
- True (Precondition must be true to execute a post function)
- False (Precondition must be false to execute a post function)
You can find more generic description of precondition here
Copy attachment from/to all issues related as
You have several different options, which defines which issue/s will be treated as source/destination for attachments.
Several of JSU's workflow modules provide the option the define the scope of the module on some related issues.
For example instead of copying attachments from one issue to the others you might choose to copy them from all linked issues to the issue in transition (e.g. to group all attachments within one issues)
Types of issue relations
Related issue will be found by one of the following JIRA concepts:
- Issue Link
You can define the link type to defined which issues exactly will be affected by the operation.
Since JSU 2.2.0, we introduced the value ANY. The operation will be performed on any linked issues.
- Parent / Sub-Task
The related issue is either parent or sub-task of each other.
- Epic / Issue in Epic
This is only applicable, if you have JIRA Software installed.
The other issue is either the epic related by an epic link, or it is part of an epic.
Issue in transition
We use the term 'Issue in Transition' when we refer to the issue for which a workflow condition is checked, for which a workflow validator is examined, or for which a workflow post function is performed.
Or in other words that issue, which triggered a workflow condition / validator / post function to be executed.
Conditional copying attachments
Conditional copying attachment (controlled by custom field) is checked always only for issue in transition.
Independently if issue in transition is a source or destination.
Source and destination
For example the Copy Value From Other Field Post-Function allows you to define the issue in transition as the source or destination of the copy operations, while you define the other end with an issue relation.
The field value will then be read from the source issue and be written to the destination issue.
Other workflow modules do not have source and destination. So you just define the issue relation, which will apply for that workflow module.
For example Create a Linked Issue will just create a new issue and then connect it with some Issue Relation to the issue in transition.
Controlled by custom field
Here the idea is, that you have a checkbox custom field on the transition screen, so the user can control some of the functionality.
For example a checkbox 'Copy Existing Attachments' might be configured as Custom Field that enables copying existing attachments. Only if it is ticked, all attachments will be copied.
Typically this checkbox custom fields won't appear in the normal screen of the issue.
Instead of letting the user choose to copy/move the attachments, you can also configure to never/always copy them.
Tip: You might choose 'Move Attachments added during Transition'. The user then adds some attachments on the transition screen of the source issue. However since they are moved to all related issues, it feels as if he just added the attachments to all related issues.
Position of the Post Function
If you use 'Move Attachment' (see bellow) you must position the post function before 'Update change history for an issue and store the issue in the database.'
This post function can be also used in a combination with preconditions.
If you use 'Move Attachments added during Transition' it is important that the 'Copy / Move Attachments' Post-Function is before JIRA Post-Function 'Update change history for an issue and store the issue in the database'!
In such case "Copy Move Attachments" has to be placed between "Update change history for an issue and store the issue in the database" and "Re-index an issue to keep indexes in sync with the database"
Otherwise transition attachment will not be properly stored and it will be not attached to the current issue.
Due to a Bug in Jira JRASERVER-65939, 'Copy or Move Attachments' functionality, which are added through a Transition Screen, does not work in Jira 7.5.x & 7.6.0. If you require this functionality, please upgrade to minimum Jira Version 7.6.1!
Already existing attachments are not copied again
When an identical attachment (same file name and same content) already exists in the destination issue, it will not be copied again. This is the case for both, existing and transition attachments.
Real life tips
Tip: You might setup a special transition screen to mainly copy those attachments to all linked issues. So it feels more like it would be the create screen of the new issue. In that case, you won't show those fields on the origin issue, but reset them again afterwards (just empty or back to the default value).