1

We currently have four custom objects in the system and there are linked. We need to do a data import and data is in the CSV like below

From the csv, I need to create the Card first and then Section then Question and Answer. Where column 1 corresponds to Card, column 2 to the Section and Column 3 and 4 for the Question and Answers ( Two records ) in 5 and 6. How can I deal this data import, is there any easier approach I can take here, we dont have any external ID's here. I have done some simple data imports and any help is greatly appreciated

3
  • you could create for purpose of the data load external ids and then delete the fields later
    – cropredy
    Mar 9, 2023 at 1:48
  • External Id is one approach if you are good with API tool you can use this developer.salesforce.com/docs/atlas.en-us.api_rest.meta/… Mar 9, 2023 at 2:49
  • @cropredy Do we do the data loads separately for each objects using the external ID? The other issue is if you see the Answers are in the same row where I need to be creating two records for that object. Can you please help me how I can approach if they are in the same rwo Mar 9, 2023 at 3:40

3 Answers 3

0

It's going to be a bit complicated but it's doable. You must divide the attached sheet into 4 different sheets one for the Answers only, one for Questions and Answers, one for SectionM Questions and Answers and lastly one for all of them.First you need to insert Answers into Salesforce then export them using the data loader they'll come out with ids. Insert the Answers ids in the Excel sheet of the Questions instead of your data, for example if Question 1 has answer Yes, Yes will have the id (19381029842) replace Yes with this id. Import Questions sheet then export it with the ids same as last step and place ids instead of data.

1
  • actually, the Ids will be in the success.csv file so you don't have to export
    – cropredy
    Mar 9, 2023 at 1:47
0

So, if this is a one-time Data Load, I might do the following

  • Create a temporary external Id field on each of the three parent objects: Card, Section, and Question
  • Populate the CSV rows (see note below) with a value for the external Id. You can use Excel/Google Sheets to autonumber them for you
  • Then, for the child rows, use Excel formulas again to push the parent's external Id into a column
  • You'll need four files, one per object. And four data load upsert operations with external Ids
  • After all your data loads are done, then delete the temporary external Id fields in your schema

Notes

Each CSV row can upsert only one database row; so you'll need to normalize your example CSV in the OP such that Answer 1 and Answer 2 are separate rows. YOu can use Excel formulas to do this work If using Data Loader

0

You can greatly simplify the process by using XL-Connector or XL-Connector 365. They will work directly from Excel where you can save multiple mappings in the same (or multiple) sheets. Each of the mappings (we call them flow steps) can return the Id of the created record(s) back to the source data, so the next flow step can take over and continue loading the related records with a different mapping, but already having the parent Id(s) from the previous data load. If set up correctly, this way you can chain multiple uploads and even run them in one click.

You must log in to answer this question.

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