Upload Attachment
Upload an attachment to a Procore object, or to the document library of your Procore Project or Company. This action can be used to execute the following Procore APIs:
- Create Project File, which creates a new file in the specified Project's document library
- Create Company File, which creates a new file in the specified Company's document library
- Any API that attaches a file to a Procore object. The Create Incident Attachment API, which attaches a file to a specified Incident, is one example of this.
Inputs
Key | Value | |
---|---|---|
apiPath | Required | The Procore API endpoint that you wish to invoke, without the "vapid" prefix. Please refer to the Procore Actions overview for more on the apiPath input, which is required for all Procore Actions. |
fileUrl | Required | The full URL (including path and filename) of the file that you wish to attach to this Procore object. |
filePath | Required for document library attachments | The full path (including folders and filename) to which this file will be uploaded within your Procore document library's folder structure. ONLY use this parameter with the Create Project File or Create Company File API. |
fileName | Required for object attachments | The name and extension that you want to give to the file that you are attaching to the Procore object. DO NOT use this parameter with the Create Project File or Create Company File API. |
isTracked | Optional | This is a boolean input; the accepted values are "true" or "false". The default value is "false", which means that the file changes are not tracked. Set this to "true" if you want to track changes to the uploaded file. This will send an email whenever the file is added, updated or deleted. This is equivalent to checking the Track File box in the Procore interface. |
explicitPermissions | Optional | This is a boolean input; the accepted values are "true" or "false". The default value is "false", which means that the file inherits the permissions of its folder. Set this to "true" if you want to explicitly control file access. This is equivalent to checking the Make Private box in the Procore interface. |
description | Optional | A description that will appear when you view the file in Procore. This is useful for giving more context about the document you are uploading. |
Outputs
None
Usage Example
Suppose you want to upload the PDF of each completed Incident form to your Procore Project's document library. To do this, you might start with a Form Completed trigger, then follow it with a Export Form To PDF step to convert the finished form to a PDF. Then you might configure your Upload Attachment step as follows:
Key | Value |
---|---|
apiPath | /files?project_id=#{trigger.[ProjectId]} |
fileUrl | #{exportPdf.pdfUrl} |
filePath | Incidents/#{trigger.[InjuryDate]} - #{trigger.[InjuredPersonLastname]},#{trigger.[InjuredPersonFirstname]}/#{trigger.formName}.pdf |
explicitPermissions | true |
description | #{trigger.[IncidentSummary]} |
In this example, we first construct the apiPath
as described in Procore's Create Project File API documentation, using the "ProjectId" field from the completed form to fill in the required project_id
query parameter. We also use the output of the PDF export step to specify the URL of the file to be uploaded.
Next, we specify the file destination to be a folder called "Incidents" and a subfolder that references the date of the incident and the injured person's first and last name, as specified in the corresponding form fields. The filename comes from the name of the completed form. We also use the form's IncidentSummary field to fill in the file description. Finally, we make the file private, allowing us to control who can access it, using the explicitPermissions
input.
Updated over 5 years ago