function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pat McGrathPat McGrath 

Parent Asset Name?

Hi all, 
I am using Data Loader 30.0.0

I am trying to simultaneously insert some files that are related. Is there any way to do this? For example...

I am uploading an asset named 10

and i need the following asset to be named 9 and recognize that it is a subcategory to 10...

In my extracts it is called "Parent Asset Name" but the code for it seems to be the last part of the URL (i.e www.salesforce.com/123456789)

Is there any way to know what code will be generated from that asset so that i can put it into the parent asset name column and relate them?

Hopefully that is clear enough,

Please let me know and I can try to be more specific.

bob_buzzardbob_buzzard
It sounds like you are trying to specify the value for a lookup or master-detail relationship based on a record that you have just inserted.  The problem is that the relationship field requires the id of the parent category, and that isn't known until the insert succeeds.

The way to handle this is to create an external id field with a unique identifier for each category record, and specify the parent's external id value in the relationship field.   There's an explanation of how to achieve this at:

http://salesforce.stackexchange.com/questions/12710/parent-id-apex-data-loader

its based on accounts and contacts, which equates to categories and subcategories in your world.
Caleb SidelCaleb Sidel
To add to what Bob said - you can not relate something to a parent if it does not first exist. So you have to load the parents first. This can be done with 2 seperate files. This can be done by ensuring the parent records are first in the file you're loading from (but it's hard to ensure this 100% since ideally you're doing batches of 200). Or you can process the same file twice - once as the upsert without parent and then again with only mapping the parent. Ideally you'd use 2 files in terms of load efficency, but sometimes you can't always have two files created for you so the double pass is my next favorite method.
Pat McGrathPat McGrath

Thanks for all the help so far

but i'm still a bit confused

So i have my Accounts,

I then have my Assets

Then those assets have assets.

can i load the first assets along with the second assets?