Someone in my company has been sending out surveys from our LiveAgent and Email Cases. They have been passing the UserID and CaseID to the individual survey responses as a hidden field on the survey.

I have been provided a list of a couple thousand Case Id values, and need to get the email address from the Person Account on each of the cases. Because we are using live agent in a retail enviro, we don't always have a customer associated to the case.

I usually look to dataloader to pull based on criteria, but this is way different than anything i've done before.

Should I be looking into SOQL?

Is this easier to do in two stages? Query the list of CaseID to get all the AccountID, then run again to get the email value for each AccountID?

Any help appreciated, feeling the noob vibes again! :)


1 Answer 1


I realize this is a month too late on this, but still hoping I can help for future use. You will not be able to add thousands of Ids as a parameter to the Data Loader query. If this PA field is a lookup field on the case, you could easily use Data Loader to just export all records and add another field at the end of the SOQL query fields Data Loader generates to reference the lookup object. Ex:

SELECT Id, PersonAccountField__r.EmailAddress__c FROM Case

Open that in excel, then copy your original list of a couple thousand Case Ids int a new sheet and with a VLOOKUP, boom, done.

A note on referencing across objects, your limit is 4. This means that if you start at the child most object (Cases in your case) you could technically jump up 3 more lookup fields Case -> Account -> Owner -> FinalObject. All you need to do is take the lookup field, add __r to the end and the append the field of the object you wish to also see. In your example we took PersonAccountField__c and turned it into PersonAccountField__r.EmailAddresses__c. Just replace my dummy fields with your actual fields.

Another nifty trick would be to do all of this in anonymous apex from the developer console, and have the results saved into a new .csv in your Chatter files, but the amount of time it would take me to research how to do that I could've done 500 VLOOKUPs. It may be nice to figure out how to do it though, and save the script with interchangeable variables in a .txt file for later use.

  • Thanks for your response. This seems like a more "proper" solution that what I went with. Ended up using data loader with the caseID's to change a temporary checkbox to "TRUE" then ran and exported a report with the emails from withing standard salesforce reporting. then just deleted the custom checkbox
    – emosapien
    Oct 3, 2016 at 21:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .