I am pretty new to Salesforce and am trying to automate a process with a custom record in our Salesforce account using the Apex Dataloader.

The process is:

1) Create a record for the custom object.

2) Attach a file to the created record for the custom object.

I have the dataloader setup and I can achieve this process from the cmd prompt with a manually created file for the record and another manually created file for the attachment. This only works because I exported the custom object records after the first step and found the newly created ID to use on the second step.

The problem I'm running into is I don't know how I will get the ID of the created record on the fly to be used in the second .csv file to attach a file to the record. I will be creating multiple records and uploading a different attachment to each one. To get around that, I thought I would be able to create a custom field on the custom object to use as my own ID field, but it seems I can't add the same custom field to attachments to link them together. Anyone have ideas of how to get around this?

1 Answer 1


Create a file that contains the custom object and its related attachment data. The success file from the first import should have all the original fields and the newly created record IDs. You can use the success file to do the second import.

You must log in to answer this question.

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