I am pretty new with Salesforce and I am doing an integration where I have to update Salesforce with data from a Business System. I have a problem when trying to create new records in an object with lookup fields from another parent object. I am using java soap protocol with a partner connection and the field I am trying to update is of Master-Detail type. I can update it successfully if I enter the Salesforce ID for the value, but not when I enter the actual value that should go in the field.
In my example I want to update a store lookup field with a parent Account/store.
Example for Store: 7241
This does not work:
record.setField("Customer_Store__c","7241"); //Using the actual Store number
records[0] = record;
com.sforce.soap.partner.SaveResult[] results = partnerConnection.create(records);
This works:
record.setField("Customer_Store__c","001N0000007MJLO"); //Using the Salesforce ID
records[0] = record;
com.sforce.soap.partner.SaveResult[] results = partnerConnection.create(records);
However, I do not have the ID for the stores, unless I create a cross reference table somewhere, but I prefer not to. I was reading some posts online about creating relationships between the parent and child objects, but it appeared you had to create a new parent object simultaneously to get the parent object ID for the child objects. In my case the stores are already created and I only want to add records which has a relation to that store.
Does anyone know what the best practice is for this?
Maybe even have a code sample, which would be great.
Many Thanks in advance
