Get a working example of the standard screen component for uploading a single file and relating it to a record. This post is part of the Uploading and Working with Files in Flow mini series.
Ingredients:
- Install/setup flow package
- Flow: E01_001_UploadSingleFile
- Standard File Upload flow screen component (included in the flow)
- Case object – need at least one case record in your org
Video Tutorial (4 min)

What’s Happening in the Flow:
- Flow starts by looking for an input variable called caseRecordId.
- “Get Case” query: Uses the caseRecordId input variable to query for the current Case and returns its field values. In this sample, we’re only using this info in the display text on the next screen for fun.
- “Upload a Single File” screen: Displays user-facing text and the standard File Upload screen component. For a single upload, the component only has a few key properties to set:
- Allow Multiple Files – for single upload only, this gets set to false (technically,
{!$GlobalConstant.False}
). This is the only substantive difference from the “Upload Multiple Files” sample flow. - Related Record ID – pop in the input variable, caseRecordId, so that the file is automatically associated to the case when it’s uploaded.
- Allow Multiple Files – for single upload only, this gets set to false (technically,
- Checking for an uploaded file. Unfortunately, the File Upload component doesn’t have a property to make it required; so when the user clicks “Next”, we want to make sure they uploaded a file. If not, we’ll send them back to the screen and display an instructional error message.
- “Count Content Docs” assignment: This counts the number of ContentDocument Ids saved by the File Upload component and stores the count in the varContentDocCount variable. The count should only be “1” because we didn’t allow multiple file uploads.
- “File Uploaded?” decision: Based on the count, let’s direct the user:
- When the count equals 0, the “Set Flag” assignment element sets the varFlagFileNotUploaded variable to true. Then, when we redirect the user back to the upload screen and use that flag to show an error message using conditional visibility.
- When the count is greater than 0, the flow proceeds.
- “Finished” screen: No real purpose except to show you the output variables that come from the File Upload component.