CSV Export of both parent and child records from Table with Drawer?

  • 2
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
We have created a Account list view with contact Drawer. I need to export all the Account and Contact in same file. Is it possible through standard SKUID export or any code options? 
Photo of rajadurai k

rajadurai k

  • 360 Points 250 badge 2x thumb

Posted 4 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
This is absolutely possible. The most important step is that you have to add the "Contacts" Child Relationship to your Accounts Model, and ensure that you're requesting all of the Contacts that you want --- by default when you use a Child Relationship, we set a limit to pull in just 10 records, e.g. a max of 10 Contacts for each Account, but you can easily change this by going to the "Properties" settings for the Child Relationship. 

If you're unfamiliar with Child Relationships, please read this tutorial before proceeding.

Once you've added the Child Relationship to your Model, there are two ways to ensure that the Child Relationship records get included in your export. 

(1 - Easiest) If you have dragged the Child Relationship field into your Table, then the default Export settings will include the Child Relationship data in the export. For instance, if you've added the Child Relationship field "Contacts" in the table, with the Template "{{FirstName}} {{LastName}}" and a delimiter of "," then your exported file would look like this:


with these configuration settings:

 






(2) If you are specifying Export Columns manually, then you will need to add a Template column, and iterate over the Child Relationship records within the Template, like this



This would be done with the following settings for the Export Columns:

Photo of rajadurai k

rajadurai k

  • 360 Points 250 badge 2x thumb
Thanks for your response
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,270 Points 5k badge 2x thumb
Is there a way to make each Contact record its own Column?
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,270 Points 5k badge 2x thumb
YES!!!

Create one template field with 
{{#ChildObject__r.records.0}}{{ChildObject__r.records.0.ChildFieldName__c}}{{/ChildObject__r.records.0}}

Then another with 
{{#ChildObject__r.records.1}}{{ChildObject__r.records.1.ChildFieldName__c}}{{/ChildObject__r.records.1}}

and so on
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,270 Points 5k badge 2x thumb
I had no idea there were Export Options on a table. So cool. So it looks like i could have the Skuid table should one column with all the Contacts in a bulleted list, but then when you export it splits them out into columns. Amazing!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Woot!  Amazing indeed!