Visual Workflow allows us to automate business processes by building applications, known as Flows. Using Flows, a user can collect information; or, they can update, edit, or create records in Salesforce. Furthermore, Flows can execute logic, interact with the Salesforce database, call Apex classes, Platform Events, and guide users through various screens to streamline the process of collecting and updating data. Once a Flow is built, an Admin can make the Flow available to the right users or systems.
Before Spring’18 release, it was not possible to attach a file from a Flow. For example, if you build a Flow that allows your sales rep to create a Contract you would also want them to attach a Contract PDF file through a Flow. Before Spring’18 release, however, it was not possible to attach a PDF file via a Flow.
After Spring’18 release, however, with just a few clicks, users can now attach files Contract, or other Objects, via a Flow! An Admin can allow users to upload files from a Flow by adding the File Upload (forceContent:fileUpload) Lightning component to a Flow’s screen, as shown in the following screenshot:
Furthermore, an Admin can also customize Accepted Formats in a Flow to further specify which image file formats a user can upload. However, note that, any files, that are either non-images or are not in the Accepted Formats, cannot be uploaded! This change applies to Lightning Experience and Salesforce iOS app. Also important to note here is that the File Lightning Component works only for Flows that use Lightning runtime.
In this article, I am going to show you how one can use File component in a Flow and then make it available to business users. Let us start with a business use case.
Business Use Case
Edward Backhouse is working as System administrator at GurukulOnCloud. He received a requirement from upper management to create a Flow that allows reps to create Leads and upload their business cards from it. The requirement also includes following asks:
- Reps must be able to upload multiple Business Cards of prospects that belong to the same company
- And, secondly, the Reps must only be able to upload files of type .jpg, .png and .Pdf.
Solution for the above business requirement
There are a few possible solutions for the above business scenario. For example, you can use Evernote or similar applications – that allows a user to scan business card from mobile and auto create leads into Salesforce. However, our purpose, in this blog, is to learn Flow and its advanced/new features. Therefore, we will use Flow and new File lightning component to solve the above business requirement. To do so, follow the steps listed below:
- Navigate to Setup (Gear Icon) | Setup | Process Automation | Flows in Lightning Experience.
- Then click on the New Flow button – it will open the Flow canvas for you.
- Create a sample Flow (add two text fields to it to store LastName and Company) as shown in the following screenshot: –> Remember, to create a Lead we need LastName and the Company information of prospects; for, these are required fields! However, feel free to add more fields if your use case calls for additional fields. Read the rest of this entry!