SharePoint Connector for Jira - Cloud

Copy attachments from new work items

TUTORIAL 3 OF 6 10 MIN INTERMEDIATE SPACE ADMIN

Attachments added while creating a work item are copied to its new SharePoint folder right away.

Why a separate tutorial? Attachments added during creation are part of the creation event, so the trigger from Copy attachments as they’re added doesn’t fire for them. Instead, this tutorial extends the rule from A SharePoint folder for every new work item and goes through all attachments of the new work item.

:check_mark:

What you’ll learn

  • Why attachments at creation need their own setup

  • Go through all attachments with advanced branching

  • Use a branch variable as input

Automation_CopyNewWorkItems.gif
New work item with attachments copied to SharePoint

Outcome: When you create a work item with attachments, copies of the attachments appear in its new folder.

Rule at a glance

image-20261027-090156.png
The finished rule
  1. TRIGGER Work item created

  2. ACTION Create SharePoint folder

  3. ACTION Connect SharePoint item to work item

  4. BRANCH For each attachment in {{issue.attachment}}

    • ACTION Upload Jira attachment to SharePoint

    • ACTION Connect SharePoint item to work item

Steps 1 to 3 are the rule from A SharePoint folder for every new work item.

Step-by-step setup

1. Open the rule from tutorial 1

Go to Space settings > Automation and open the rule from A SharePoint folder for every new work item, for example Create exchange folder.

Keep everything in one rule. That way, the folder exists before the first upload starts.

2. Add an advanced branch

After Connect SharePoint item to work item, add Branch > Advanced branching and fill in the fields.

Field

Value

Smart value

{{issue.attachment}}

Variable name

attachment

The branch runs the next steps once for each work item attachment.

image-20261027-085634.png
Advanced branching for all attachments

3. Copy each attachment

In the branch, add the Upload Jira attachment to SharePoint action and fill in the fields.

Field

Value

Location

{{createdSharepointItem.folderUrl}}

Attachment name

{{attachment.fileName}}

Conflict behavior

Keep both

The variable name from step 2 becomes the start of the smart value: attachment turns into {{attachment.fileName}}. Smart values are case-sensitive, so {{attachment.filename}} doesn’t work.

image-20261027-105807.png
Upload Jira attachment to SharePoint action

4. Show each file on the work item

Inside the branch, after the upload, add the action Connect SharePoint item to work item and fill in the fields.

Field

Value

Work item

{{issue.key}}

Item URL

{{createdSharepointUpload.itemUrl}}

5. Save the rule

Select Save. The rule stays enabled.

Create a work item and attach two files in the create dialog. Both copies appear in the new folder and in the work item’s SharePoint panel. If they don’t, check the rule’s audit log.

Make it yours

Recipe

Change

STANDALONE Without tutorial 1

Create a new rule with the trigger Work item created and the action Create SharePoint folder, then continue with step 2.

CLEANUP Remove the files from Jira

Inside the branch, 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}}.