0

I would like to insert a few hundred records into a custom object. The custom object has a self lookup. The custom object use is to replace a series of dependent picklists, 3 levels deep.

For example, record 1 is the parent of record 2. Record 2 is the parent of Record 3.

At present there are no records in this custom object.

I know that it is possible to use workbench to insert all records in one go. However I'm struggling to use the smart lookup function and the documentation is extremely brief.

Here is a highly reduced version of the data and mapping i'm using:

Record 1: Name = a Parant = '' External_Id__c = a

Record 2: Name = b Parant = 'a' External_Id__c = b

Record 3: Name = c Parant = 'b' External_Id__c = c

When creating the mapping in workbench, I set the parentId to the parentID field in the CSV, and then the smart Lookup value to the object.external_id__c. This returns an error saying:

Foreign Key External ID: a Not Found For Field External_Id__c In Entity customObjectName

Can anyone tell me where I'm going wrong?

Note: I'm aware this can be done in multiple passes and also Talend.

  • 3
    It seems that A insertion is not done at the moment he starts processing B. I noticed this behavior when trying to insert emails in a specific order : salesforce.stackexchange.com/questions/172494/… . I resorted to Talend to insert them unitary in the correct order in the end. You should go for Talend it will save you time. – Answers_Seeker Sep 26 '17 at 11:50
  • I just tried to Upsert instead and it worked for some reason. Not sure why. Thanks for the info all the same – Jay Sep 26 '17 at 13:28
0

My method was correct however I had to use Upsert, not Insert. Also, you may need to set batch size to 1.

|improve this answer|||||
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – rael_kid Sep 27 '17 at 13:18
  • 1
    The approach detailed in the question is the correct approach. Only use upsert with a batch size of one to it run successfully. – Jay Sep 27 '17 at 13:19
  • 1
    I'm happy to answer any questions you have if you're facing a similar problem though – Jay Sep 27 '17 at 13:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.