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.0 – 4/19/20

View Source

Source

0 0 vote
Article Rating
Subscribe
Notify of
guest
18 Comments
Inline Feedbacks
View all comments
Adam White
Adam White
1 month ago

Looks like we were beaten! Nice job Narender.

Alex, what were some of the use cases for this? I’d assume it’s for power users / org champions that might not be able to get elevated privileges to do mass record loads?

Alex Edelstein
Alex Edelstein
1 month ago
Reply to  Adam White

I think this is a little more nimble and flexible than the old guard of data upload tools. In particular, the flow approach emphasizes the ability to chain different tools in a sequence. Many times, you want to not just create the records from a CSV file but also modify them first.

Adam White
Adam White
1 month ago
Reply to  Alex Edelstein

So I’d actually like the inverse of this – I want a CSV generated from a given sObject collection, or even the output of a SOQL query using ExecuteSOQL.

This would be quite powerful in situations where SF Reports can’t do what you need it to do (which is often, sadly). Schedule a flow, use ExecuteSOQL to build your collection, use our handy dandy de-duper action if needed on the collection, then generate a CSV and use the Send Email action from here on USF.

I might have my team work on that if nobody else wants to.

Adam White
Adam White
1 month ago
Reply to  Alex Edelstein

Definitely – where I get hung up is how to combine it with ExecuteSOQL as well as any ole’ ‘Get’ step. Like it would be super powerful to have the ExecuteSOQL action include some Counts / groupings in SOQL and have that output to the CSV, but that might increase the complexity quite a bit.

Adam White
Adam White
1 month ago
Reply to  Alex Edelstein

Awesome – stay tuned!

Adam White
Adam White
1 month ago
Reply to  Alex Edelstein

Alex – what about apex defined types? let’s say I had a series of unrelated objects and I wanted to create a bunch of joins that aren’t supported in SOQL. we could potentially create an apex-defined type with some associated records and then pass that into the CSV, is there something like that we could do generically?

Gidi Abramovich
Gidi Abramovich
1 month ago

Well done, Narender!
Thanks, Alex, for your demonstration.

Gidi

Narender Singh
1 month ago

Hey Alex,
Quick suggestion: You may want to update the ‘CSV File Considerations’ and that there should be no NULL values in the last column of CSV.

Vinay Vernekar
30 days ago

Nice Article, Its very useful. Just wanted to know its not possible to use in Professional edition right?

Nages
Nages
30 days ago

The link to GitHub is broken and couldn’t install from package, getting test class failure. Please check

asher Diba
asher Diba
10 days ago
Reply to  Nages

wasn’t able to install also…

Scott Landes
Scott Landes
3 days ago
Reply to  Alex Edelstein

I’m also not able to download – the error says it’s been deprecated from the AppExchange. Is there a new link I can install this from? Thanks!
 
“The AppExchange package has been deprecated and can no longer be installed. Please try installing a newer version, or contact the package owner directly to resolve”

Screen Shot 2020-06-01 at 4.43.48 PM.png

trackback

[…] CSV invoked action for you all. I consider this the inverse of Narender Singh’s ‘Create Records from CSV‘ action. We built this to fully utilize some of UnofficialSF’s awesome custom actions […]

trackback

[…] Couldn’t find the time to post this sooner, kudos to Alex for doing the article on it. Click here to read more about the details of Flow Apex […]