top of page

How to Upload a File and Relate it to a Record in a Flow


We were tasked with developing a way to allow customers to create a Case record via Flow. The flow needed to require the customer to upload file attachments for their Case to be created.

Our initial solution was to create a Screen Flow that created the case and then captured the related file attachments once the Case record had been inserted. This seemed to be a viable solution since File records cannot be created without being related to a record Id.

Issues arose when customers were accessing the Flow and cancelling out of the browser once the Case had been created but before the Flow was complete. This was allowing the Case to be created in the system while bypassing the remainder of the Flow and the required file upload.

We quickly realized that we needed a solution that would create both the Case and File record simultaneously, removing the capability to create a Case without the required files.

Proposed Process Automation

When the Screen Flow launches, the file upload and all necessary Case fields are available on the first screen in the Flow. This will capture both the Case information and Files simultaneously, but not insert them.

When the files are uploaded, they are assigned a Content Document Id number, which is an Id that is automatically created when any file is uploaded. A collection variable will then be used to capture the output Content Document Id number(s) of the files uploaded.

Once the Case is created, there will be a loop through the collection variable with the assigned Content Document Id number(s) that will relate them to a Content Document Link object record, which is a junction object between any type of record Id and the Content Document Id. This will allow the files to relate to the case record Id and insert them into the system simultaneously.

6,857 views0 comments

Recent Posts

See All


bottom of page