SharePoint Connector for Jira - Cloud

Copy attachments as they’re added

TUTORIAL 2 OF 6 5 MIN BEGINNER SPACE ADMIN

Every attachment added to a work item is copied to the work item’s SharePoint folder, where your team can open, share, and co-edit it.

This tutorial builds on A SharePoint folder for every new work item.

:check_mark:

What you’ll learn

  • React to new attachments with a trigger

  • Find an existing folder with Get SharePoint item

  • Copy an attachment to SharePoint and show it on the work item

Automation_CopyAttachments.gif
New attachment copied to SharePoint

Outcome: When someone adds an attachment to a work item, a copy appears in the work item’s SharePoint folder.

Rule at a glance

image-20261026-145636.png
The finished rule
  1. TRIGGER Field value changed: Attachment

  2. ACTION Get SharePoint item

  3. ACTION Upload Jira attachment to SharePoint

  4. ACTION Connect SharePoint item to work item

Step-by-step setup

1. Create the rule

Go to Space settings > Automation, then select Create flow. Choose Create from scratch.

image-20261026-103238.png
Create rule from scratch

2. Add the trigger

Select the trigger Field value changed. Set Field to Attachment and Change type to Value added.

This trigger only reacts to attachments added after the work item exists. For attachments added during creation, see Copy attachments from new work items.

image-20261026-145918.png
Select Field value changed

3. Find the work item’s folder

Add the action Get SharePoint item and fill in the fields.

Field

Value

Site

The site from A SharePoint folder for every new work item

Document library

The library from A SharePoint folder for every new work item

Item path

Folder path and folder name from A SharePoint folder for every new work item, for example Exchange/{{issue.key}}

The item path must exactly match the folder path and name. If you named your folders with the key and the summary, the folder isn’t found after someone edits the summary.

image-20261026-150133.png
Add the Get SharePoint item

4. Copy the attachment

Add the action Upload Jira attachment to SharePoint and fill in the fields.

Field

Value

Location

{{fetchedSharepointItem.itemUrl}}

Attachment name

{{changelog.Attachment.toString}}

Conflict behavior

Keep both

{{fetchedSharepointItem.itemUrl}} contains the URL of the folder that step 3 found. {{changelog.Attachment.toString}} contains the name of the attachment that was just added.

Keep both is the safe choice. If a file with the same name already exists in the folder, for example, a new version of contract.pdf, it’s stored as contract_1.pdf. Overwrite replaces the existing file. Skip doesn’t upload the file.

image-20261026-150303.png
Upload Jira attachment to SharePoint

5. Show the file on the work item

Add the action Connect SharePoint item to work item and fill in the fields.

Field

Value

Work item

{{issue.key}}

Item URL

{{createdSharepointUpload.itemUrl}}

{{createdSharepointUpload.itemUrl}} contains the URL of the file uploaded in step 4.

image-20261026-150347.png

6. Turn it on

Name the rule (for example, Copy attachments to SharePoint), then turn it on.

Try it

Add an attachment to a work item that has a folder. A copy appears in the folder and in the work item’s SharePoint panel. If it doesn’t, check the rule’s audit log.

Make it yours

Recipe

Change

FALLBACK Work items without a folder

Replace Get SharePoint item with Create SharePoint folder, using the same folder name. It returns the existing folder or creates a new one. Set Location to {{createdSharepointItem.folderUrl}}.

PANEL Folder only

Remove step 5 if the connected folder in the SharePoint panel is enough.

CLEANUP Remove the file from Jira

After the upload, add Jira’s Delete attachments action with {{createdSharepointUpload.uploadedFileName}}, and set Conflict behavior to Overwrite. With Keep both, the name in SharePoint can differ from the one in Jira. With Skip, nothing is uploaded, but the attachment would still be deleted.

NOTIFY Post the link in a comment

After the upload, add Jira’s Comment on work item action, for example: Copied {{createdSharepointUpload.uploadedFileName}} to SharePoint: {{createdSharepointUpload.itemUrl}}.