How to Upload Files Using Screen Flow in Salesforce 

In Salesforce, we create and implement flows to automate the data process and maintain records in the org. With the help of a Salesforce flow, we can also upload files to records or related records.

In this Salesforce tutorial, I will explain the method to upload files using Screen Flow in Salesforce.

Upload Files Using Screen Flow in Salesforce

We can use the Screen flow to upload files for two use cases:

  • Uploading files for the current record.
  • Uploading files for the related records.

Upload Files Using Screen flow for the current record

To create a Screen flow for uploading the files in Salesforce, open your Salesforce developer console and follow the below steps.

1. On the setup page, go to the Quick Find box and then search and select Flows under the heading Process Automation.

Create a Screen flow to upload files in Salesforce records

2. In the Flows setup window, click on the button New Flow.

How to upload files in Salesforce using flow

3. In the Salesforce Flow builder, click on the “+” icon on the flow and add the Screen element.

Create a flow to upload files on current record in Salesforce

4. Enter the label and API Name for the screen, then from the left sidebar, drag and drop the File Upload component.

How to upload files on current record in Salesforce using flow

5. Enter the API Name and File Upload Label. The label will be displayed to the user on the screen flow.

Upload file on Current record with Salesforce screen flow

6. In the field Related Record Id, we have to parse the id of the current record and, for that, create a New Resource for this field.

Create a Screen flow to upload files on current record

7. Enter and select the below fields to create a resource for getting the ID of the current record.

  • Select the Resource Type as Variable.
  • Enter the API Name as RecordId.
  • Select the Data type as Record and Object as Account.
  • Activate the options available for input and output.
  • At last, click on Done.
How to upload files to current record in Salesforce using flow

8. We have completed the screen element. Now click on Done to save this.

Salesforce flow to upload file on record page

9. Enter the relevant name for Flow Label and Flow API Name to save this flow.

Create a Screen flow to upload files for current record in Salesforce

10. To use this flow, it is required to activate it; for that, click on the Activate button.

Upload file on Current record in Salesforce using Flow

Add flow to the record page and upload a file through flow

1. Go to the Setup -> Navigate to Account tab -> Open a record -> Click on the settings icon and click Edit page.

Screen flow to upload files on the current record

2. Drag and drop the flow component to the template region.

Use screen flow to upload files on current record

3. Select the created flow from the Flow field, then activate the checkbox Pass record ID into this variable.

See also  How to Use Decision Element in Salesforce Flow

At last, click on the Save button to apply changes.

How to upload files to current record using flow

4. Go back to the account record page, and in the screen flow, click on Upload Files.

Upload file on Current record in Salesforce using screen flow

5. Select the file from your system, and after the upload, click on the Upload button.

Now, we can view the uploaded files in the Files and Attachments section on the record page.

In this way, we can upload files using screen flow for the current record by following the above steps.

Upload Files Using Screen Flow for the Related Records

In the below steps, we will create a screen flow when we create a contact for an account, and the contact ID will be stored in the Screen element to which we will upload the file component.

We need the contact ID because the Upload file component asks for the ID of the related record (parent or child).

Now follow the below steps to create a screen flow to upload files in the related records.

1. On the Setup page of Salesforce, go to the Quick Find box and search, then select Flows.

Create a Screen flow to upload files on related record in Salesforce

2. In the Flows setup window, click on the button New Flow.

3. Select the option Screen flow, and click Create.

How to Create a screen flow to upload files to related records in Salesforce

4. In the Flow builder click on the “+” icon and select the Screen element.

5. Enter the Label and Api Name for the screen, this screen will take input to create contact in the current account. For that, drag and add Text component to the screen region.

Create a Flow to upload files on Account contacts in Salesforce

6. In this screen, I have added two text components that will take input from users. After this, enter the Label and API Name for the components, then click Done.

Upload file on related record in Salesforce using Flow

7. Below the Screen element, add a Create Record element.

See also  How to Create and Deploy Scheduled-Trigger Flow in Salesforce

8. Enter the below details to create the Get Record element.

  • Enter a relevant Label and API Name.
  • Activate the radio button; use separate resources and literal values.
  • Select the Object as Contact.
  • In the section Set Fields Values, we have to map the object fields with values we created in the screen flow.
Create a Screen flow to upload files in Salesforce

9. Add another field AccountId, and to get the id of the current account record, create a New Resource.

How to upload files in Salesforce using Screen flow

10. Enter the below details to create resources for getting a currency account id.

  • Select the Resource Type as a Variable.
  • Enter the API Name as RecordId.
  • Select the Data type as Text.
  • Activate the checkbox Available for input and Available for output.
  • At last, click on the Done button.
Create a Screen Flow to upload files on Account contacts in Salesforce

11. Activate the checkbox. Manually assign variables and select New Resource in the Variable field.

Create a Screen flow to upload files in child record in Salesforce

12. Enter the below details to create the resource that will store the ID of Account contact.

  • Select the Resource type as Variable.
  • Enter a relevant API Name for the resource. For example, I have entered it as StoreContactId.
  • Select the Data Type as Text.
  • Activate the checkbox, available for input and output.
  • At last, click on the Done button.
How to add flow to upload files in Salesforce related records

13. After creating the Get record element, add another Screen element below that.

14. In this screen, first enter the API Name and label for the screen. After this, add the File upload component to the screen region, then add the add label api name for the file upload component also.

After this, go to the field Related Record ID and enter the value that you created for the resource in the above steps to store the contact ID, then click the Done button.

Create a flow to upload files on related record in Salesforce

15. Now click the Save button in the flow builder. Then, in the next window, enter the Flow Label and API name, then click Save.

Create a Screen flow for uploading Files in Salesforce

16. To use this flow, we need to activate it, and for that, click the Activate button.

Salesforce Screen flow to upload file on record page

Till we have created and activated the screen flow, after this, we need to add this flow on the record page.

See also  How to Use Decision Element in Salesforce Flow

Add file upload Screen flow to the Record page

Follow the below steps to add the created screen flow on the account record page.

1. Navigate to the Accounts tab -> select any Account record-> Click Settings icon -> select Edit page.

Screen flow to upload files on the current record

2. In the app builder, drag the flow component to the template region.

Add a file upload flow on the record page in Salesforce

3. In the right-hand bar, select the flow in the flow that you created in the above step, then click Save.

Create a Screen flow to upload files on related record

4. Go to the record page; on the first screen of the flow, enter the details to create a contact record, then click Next.

Upload file on related record using Flow in Salesforce

5. In the second screen, click on the button Upload Files.

How to upload file in related record using Flow in Salesforce

6. Select a file from your system and click on the Done button.

Screen flow to upload files on the related record in Salesforce

7. Click the Finish button on the screen flow.

8. Go to the newly created record, and there you will see the uploaded file in the Notes & Attachments.

Add and upload files to related records in Salesforce using flow

In this way, we can Upload files using screen flow for the related records by following the above steps.

Conclusion

In Salesforce automation, we can use Screen Flow to streamline your file management processes. By following the above steps, you might have understood the process of creating a screen flow to upload files in Salesforce records.

We can use the same process to upload files through the screen for the records and related records of other data objects.

You may like to read: