Upload file from Flow Screen - Salesforce


Hello Trailblazers,

Today I am going to explain how we can upload a file using salesforce flows. Recently salesforce has introduced an input component – File Upload, with the help of which we can upload files as well through screen in flows. 

Before using File Upload component, let’s understand some properties to configure this component. To set these attributes we can enter simple text value or create resources or use flow constants.


Attribute   Description
 Accepted Formats  This attribute specifies the list of file types that would be accepted as input. This value should be text field with multiple extensions separated by comma. Example – ‘.docx,.pdf,.pptx’
 Allow Multiple Files  If this attribute is set True then multiple file upload will be enabled. Use global constants here.
 API Name  API Name for component.
 Disabled  Whether to keep component disabled or not.
 File Upload Label Information text above upload button.
 Hover Text  Tooltip on file upload component.
 Related Record ID  ID of the record to associate the files with. If no value is passed, the component is disabled.

Once file upload is successful you can store component’s values in below attributes so that those can be used further.
  • Content Document IDs – Ids of uploaded files, collection of text values.
  • Upload File Names – Names of uploaded files, collection of text values.
Let’s create a simple screen flow to understand use of file upload component. We will create a screen element which will upload a file related to Case record. We will add this flow to Case Record Page.
  • Click Setup.
  • In the quick find box type Flows.
  • Select Flows and click on New Flow.
  • Select Screen Flow and click on Create.

  • Since we will be using this flow on record page we will use record id as an input for this flow so that it can be used as parent id for the file. So for that we need to create new resource of type text variable and mark it as available for input.

  • You can select Auto Layout or Free Form layout for builder as per your convenience. I will be going ahead with Auto-Layout.
  • Click on Add Element (+ icon) and select Screen. 
  • Enter required information for Screen. Now from input section screen elements find File Upload and double click on it.

  • Enter desired values in API Name & File Upload Label attributes. Select variable which we created previously for record id in Related Record ID attribute.
  • Save the flow and activate it.
  • Now open any case record and click on Edit Page from Gear icon.
  • Add the flow on layout and select Pass record ID into this variable for recordId variable.


  • Now save and test this flow. 
Let me know if you face any issues.

Salesforce flow is becoming more powerful in terms of its ability to provide solutions without writing single line of code. File upload is another addition to it. We can use this component to create a form where we will take record information along with related documents in single screen and then create new record with these related documents.

Comments

Popular posts from this blog

Salesforce Flow - Create multiple records from user input

Scan barcodes from Salesforce Mobile App

Zip or Unzip Files in Salesforce