Skip to main content

Copy File Field to Another Work Item

Copy File Field to another work item copies the files held in one File Field onto a File Field on a different issue, as a step in a Jira Automation rule.

A typical case: a service request arrives with a dozen attachments, someone moves the three that matter into a File Field, and the rule that opens the development ticket copies just those three. Copying the issue's built-in attachments would bring back all twelve.

In the action's configuration you set four things: the issue and File Field the files are read from, and the issue and File Field they are copied to. An optional checkbox decides what happens when the source field is empty.

A Jira Automation rule — a “Work item created” trigger with a condition, followed by the “Copy File Field to another work item” action, whose panel shows the From issue, From File Field, To issue and To File Field inputs filled in, and the Clear the target field when the source has no files checkbox below them
The action in a rule: each new work item that meets the condition gets the files held on one template work item

What this action does​

When the rule runs, the action:

  • Reads the files held in the File Field you point it at
  • Copies each one onto a File Field on another issue, keeping its name, type, and size. Only the current version of each file is copied, not its version history
  • Replaces whatever the target field held before, removing those files together with their version history. Run it again after the source changes, and the target follows
  • When the source field has no files, leaves the target field as it is, or empties it if Clear the target field when the source has no files is ticked
  • Leaves the source field untouched, so the original issue keeps everything it had

The copied files behave exactly like files someone attached to the field by hand: they show up as file cards with Download and Delete, and they're searchable in JQL right away.

The action copies only the files attached to the field. Reference documents belong to the target field's context, so they already appear on the destination work item if that context covers it, and nothing is duplicated.


Add the action to a rule​

  1. Open Automation

    Go to Project settings → Automation, then create a new rule or open an existing one.

  2. Choose a trigger

    Any trigger works. Work item transitioned is a common choice here: the files travel when a request is approved, not when it is raised and its attachments haven't been reviewed yet.

  3. Create the issue that receives the files

    If the target issue doesn't exist yet, add a Create work item action first. The copy step can then point at it with {{createdIssue.key}}. If the target issue already exists, skip this step and use its key.

  4. Add the action

    Click + below the last step, choose Action, search for file field, and pick Copy File Field to another work item.

    The “Add an action” panel in the Jira Automation rule builder — searching for “file field” lists both File Field actions under Other apps, with “Copy File Field to another work item” highlighted
    Search for “file field” and pick the action from the list. Both File Field actions appear under Other apps
  5. Configure it

    Set the four inputs described below, tick Clear the target field when the source has no files if the target should follow the source down to empty, then save the rule and turn it on.

    The configuration form for the Copy File Field to another work item action — From issue set to the triggerIssue.key smart value, a source File Field dropdown, To issue set to the createdIssue.key smart value, a target File Field dropdown, and the unticked Clear the target field when the source has no files checkbox
    The issue and field the files are read from, the issue and field that receive them, and the optional clear box

Configure the action​

The action has four inputs and one option:

InputWhat it isSmart valuesDefault
From issueThe issue holding the files to copy.Yes{{issue.key}}
From File FieldThe field whose files are copied, picked from a list of the File Fields on your site.No—
To issueThe issue that receives the files.Yes—
To File FieldThe field that receives the copies. Its current contents, including file version history, are replaced.No—
Clear the target field when the source has no filesA checkbox. Ticked, an empty source empties the target field. Unticked, an empty source leaves the target's files as they are.NoUnticked

From issue is pre-filled with {{issue.key}}, the issue the rule is working on, which fits most rules. Inside a branch, use {{triggerIssue.key}} to refer back to the issue that started the rule.

To issue is normally {{createdIssue.key}}, the issue produced by a preceding Create work item action. A literal issue key works too, as does any smart value that resolves to one.

The source and target fields are picked separately because they're often not the same field. A File Field's context is set per project and issue type, so the field on a service request in JSM and the field on a development ticket in a software project are frequently two distinct custom fields. Both dropdowns list every File Field on your site by name. Make sure the target field's context covers the receiving issue's project and issue type, and that the field is on that project's issue view screen. Otherwise the copy succeeds, but nobody sees the files.

All four inputs are required. The rule can't be saved until each is filled in. The checkbox is optional, and rules created before it existed behave as if it were unticked.

To mirror a field into linked work items, trigger the rule on Field value changed for the source field, add a Linked work items branch, and put the action inside it with From issue {{triggerIssue.key}}, To issue {{issue.key}} and the clear box ticked. The linked work items then follow every change, down to the last file removed.


What happens when the rule runs​

The rule doesn't wait for the copy. The files usually appear in the target field within seconds, and the audit log records that the copy was started, not that it finished, so check the field on a real work item to confirm the rule works.

When the source has no files, the target keeps its files, or is emptied if the clear box is ticked. If From issue points at the target work item itself, which is what the default {{issue.key}} does inside a branch, the run fails instead of clearing it.

The rule acts as the account shown at the top of the action's panel. That account must be able to see the source work item and edit the target one. A run copies at most 50 files, 100 MB per file and 500 MB in total; a run over the limits changes nothing. See Copy limits.


What's next?​