I have a dataloader CLI process setup to import a csv file from a share folder. I am upserting to an object in Salesforce. This object is a junction object called employee training. The junction has two master-detail relation ship to employee and training object. I have a CSV file in share folder with training name and employee id , which I want to upsert to the junction object. I have employee id custom field on junction object which I use as external id for upsert operation.

My problem: I do not have option to add new field or make changes to csv file. WHen I upsert the junction object record with data like below:

    Employee    Training    EmployeeId  
    John          Course1     123  
    John          Course2      123

When I run the datalaoder CLI I am unable to create a new junction object with data -( John Course2 123). I guess the problem is I am using the external id as employeeId to do the upsert operation. Since a junction object with external id already exists(John Course1 123) it is unable to add a new junction object(John Course2 123).

What I want:

I want a external id to be defined which is combination of EmployeeId+Training values. I do not have a option to add this external id to my csv file. Is there a way in salesforce I can populate this field before I upsert it to salesforce?


I have a found a solution based on how my business requirement works. I had to only insert new records and it does not matter if there are any duplicates. Since I do not have to update the records I changed the process-config.xml to do only insert operation and made the external id as not unique. This way I could insert new records of the junction object. Hope it helps if some one is looking encounters such a scenario.

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.