Narender Singh Brings CSV Imports to Flow

You can now upload CSV data and turn it into Salesforce records with just a couple of Flow elements, thanks to Narender’s excellent response to the 1st Chance for Glory published a few weeks back. Make sure to check out his blog at https://forcepanda.wordpress.com/

(Interested in exporting records to CSV? Check that out here)

Here’s all that’s needed to take a typical CSV file and turn it into a collection of Accounts that you can save or modify.

The work is done by the ConvertCSVToRecords invocable action that Narender created. It takes as input one or more Content Document ID’s. This is the main way you refer to files that have been uploaded to Salesforce. In the example above, we use a standard File Upload screen component to upload a CSV file. It outputs a Content Document ID which is then fed into the new action.

The action takes advantage of the recently added support for generic SObjects in invocable actions. This is the same enhancement that enables Collection Actions. Here, at design time, I specify both the name of the object type “Account” and you select Account as the expect output from the action:

Operating Note: The File Upload component that comes with Flow requires a recordId to be provided, and it stores uploaded files ‘on’ that recordId. This makes a lot of sense when you’re trying to upload Account or Contact-related files, but doesn’t make a lot of sense here where we’re just trying to import data. As the video here shows, I actually created a separate object just to hold these values.The import process doesn’t actually make use of this related record. This is all a little annoying, and hopefully someone will come up with a File Upload component that doesn’t have this requirement.

CSV File Considerations

The first row of your file should consist of the field names you want to upload. Make sure you use apinames, include “__c” for your custom fields, and pay attention to the required fields for the records you’re uploading. Note: there should be no NULL values in the last column of CSV.

Attributes

Inputs

Object API NameRequired. Tells Flow what to convert your data into. Example “Account”. Make sure your CSV file has all the required fields
Content Document IDA single Content Document record ID string

List of CSV File IDs
Collection of Strings.

Output

A collection of Records

Install Package

Version 1.01 – 6/13/20 -removed export files, as they have been obsoleted by this work.

Old versions

View Source

Source