2

I'm currently using Jitterbit Dataloader.

I have an object called 'Project' and it has a self relationship (lookup) called 'Parent Projects'. During an initial import there are no parent projects so the import fails with

"Foreign Key External ID XXXXX not found for field ... "

This error makes sense because the parent project doesn't exist yet.

As for now, I've done an initial upsert without the Parent ID. Then I do a second upsert with the Parent ID. However, I'm going to be scheduling this to run constantly and just wondering how others handle this situation. It doesn't seem very efficient to do two passes when upserting the data.

What is the best practice for this type of situation?

Any suggestions?

  • 3
    I faced the same challenge, and also ended up doing the double pass - though the second pass was very fast since I was just updating the parent. I don't see another way - I thought about ordering the list to make sure I inserted the parents first, but unless you can structure the batches to never upsert parents and children at in the same batch of records, I don't see another way? – BritishBoyinDC Mar 20 '13 at 18:47
  • 1
    Somewhat academic sidenote. The only solution to do this in one pass would be to do a [dependency sort][1] on youz records before and then insert them in that order. But thats much harder than the double pass solution. [1]: en.wikipedia.org/wiki/Topological_sorting – Robert Sösemann Mar 26 '13 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.