Thursday, May 15, 2014

Use LexiLoader to Export a Subset of Salesforce Records Based on Id

I want to extract specific fields for a subset of records. I have the ids of the records that I want to extract, either from a previous export or from an exported report. But, there's really no way to extract specific fields based on just those ids.

With the Excel Connector (for Windows), this is easily done by running a query based on the ids. It's also super handy for updating those fields either individually or in groups.

But, as a Mac user, my options are limited. In fact, I don't know of another way to easily query a subset of records based on their id.

Now, this situation can probably be avoided most of the time. But, here's where I run into it: Sometimes, a user will send me an exported report or copied/pasted data and want updates to be done on the records. In that case, I might have to extract the ids from hyperlinked records first. (Here's how I do that.)

Another scenario I run into is extracting records with lookups, eg: opportunities. When I run the export with LexiLoader, any lookups (such as Account) pull in just the record ids. If I want to display the Name, I'm kind of stuck. (Although, as I'm typing this now, I realize that I can probably get around this by including the related field in my SOQL query. Doh. Oh well, I'll share my previous method just in case anyone else can benefit.)

Anyway, here's the method I used:


1. Grab your record ids that you'd like to query and update.
1. Grab your record ids that you

2. Use the record ids to build your SOQL query.

I demonstrated this technique - using a concatenated formula to build query criteria - in a short video here.
2. Use the record ids to build your SOQL query.
836ce77d-d531-4e06-9f70-831093b5b61e.png
Drag the formula in your second row of data down. You'll get the combined concatenated criteria for your query.
2caaa8ca-97b3-4080-bfd0-1f692cc20ab5.png
The last row will have all the ids ready to be copied and pasted into your query.
Mine looked like this:
'0017000000b1bFCAAY' OR ID= '0017000000b2Ca8AAE' OR ID= '0017000000cEUwnAAG' OR ID= '0017000000colvrAAA' OR ID= '0017000000eiRbPAAU' OR ID= '0017000000iewgvAAA' OR ID= '0017000000iVUjZAAW' OR ID= '0017000000mJWy1AAG' OR ID= '0017000000nXFZRAA4' OR ID= '0017000000pG0BdAAK' OR ID= '0017000000RAUMiAAP' OR ID= '0017000000SGWm9AAH' OR ID= '0017000000T1GmbAAF' OR ID= '0017000000T1O36AAF' OR ID= '0017000000T3mPxAAJ' OR ID= '0017000000T3TM4AAN' OR ID= '0017000000TEq8dAAD' OR ID= '0017000000TFRUmAAP' OR ID= '0017000000TpUqCAAV' OR ID= '0017000000TpVQGAA3' OR ID= '0017000000TVkxkAAD' OR ID= '0017000000TYg9tAAD' OR ID= '0017000000UeKKZAA3' OR ID= '0017000000UfnOFAAZ' OR ID= '0017000000UfXxrAAF' OR ID= '0017000000uMigaAAC' OR ID= '0017000000uMWgbAAG' OR ID= '0017000000uMWhQAAW' OR ID= '0017000000uMWhUAAW' OR ID= '0017000000uMWiDAAW' OR ID= '0017000000UuVBmAAN'

3. In LexiLoader, navigate to the Export wizard.

3. In LexiLoader, navigate to the Export wizard.

4. Choose your object, then click on 'Browse' to create your export file.

I have a list of Account ids, so I chose 'Account,'
4. Choose your object, then click on

5. Give the export file a name. Click 'Save.'

I usually try to be fairly descriptive so that I can easily identify the purpose of my export.
5. Give the export file a name. Click

6. Click 'Next.'

6. Click

7. Choose the fields to include.

7. Choose the fields to include.

8. Update the query formatting as necessary.

I needed to add 'WHERE id = ' so that I can proceed with the next step.
8. Update the query formatting as necessary.

9. Paste the concatenated query criteria that you copied from your last row of formulas in step 2.

9. Paste the concatenated query criteria that you copied from your last row of formulas in step 2.

10. Click 'Finish.'

10. Click

11. Choose 'Yes.'

11. Choose

12. After your export is complete, open the file that you named in step 5.

You'll see all of the records that you specified in your query criteria.
12. After your export is complete, open the file that you named in step 5.

13. Update or use your data.

When I've used this method in the past, there have been two reasons - to update a segment of records or to use them in a vlookup based on id in my original spreadsheet.

If you want to update...

There are a few different ways to do your update, depending on your circumstances.


  1. In your original spreadsheet of just ids, create a new column for each field that you want to update. Pull each column that you need in with a vlookup. This is helpful if you've already done some editing on your original spreadsheet and don't want to lose it.
  2. Use your export spreadsheet to update data as needed. This is the best option if you haven't already made changes on your original spreadsheet.

Upload your changes using LexiLoader.

No comments:

Post a Comment