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
Samyra ChrispSamyra Chrisp 

I need to update a field in a custom object with the field from another custom object when an import is finished. Can I do this with a trigger? Both objects contain a field with matching data (ClientID) that is imported from another system.

I am importing data from csv files using the dataloader into two separate objects. 
The first csv file is loaded into the account.  The data loaded includes a unique client ID field.
The second csv file loads data into a custom object and includes the same client ID field.

Is there a way to look up the accountID so that I can relate the custom object to the account that contains the unique client ID using a trigger?
 
Best Answer chosen by Samyra Chrisp
Hargobind_SinghHargobind_Singh
Hi Samyra, 

So if I understand it correctly, you are importing customers first, and then want to import customer referrals, and since you don't have salesforce IDs, it is hard to connect.

And that is where the concept of "External ID" comes in. Salesforce has created external ID system for data-imports where you have related data outside of the system and want to import it. 

I'm sure you would have some conncted field, e.g.  customer number which exists in both tables, you can tell salesforce to use that field to connect your records, and salesforce would go ahead and fill up the lookups for you. I suggest you read through the concept of external IDs and see if that resolves your problem. 

Apologies if I am totally off track with my answer.. 
 

All Answers

Hargobind_SinghHargobind_Singh
Hi Samyra, 

Am not sure i really understand the whole problem, but if you want to connect records of one table to another table, you can do that by creating a lookup and using external IDs. Here is some information: http://help.salesforce.com/apex/HTViewHelpDoc?id=faq_import_general_what_is_an_external.htm

To your answer, yes, you can do this via trigger as well.

Thx
 
Samyra ChrispSamyra Chrisp
I guess I didn’t explain what I’m trying to do. I’ll try again. I’m importing data from an outside data source “X”. The data being imported is sent to me in two CSV files - Customer Data and Customer Referrals. Both CSV files include a field for the CustomerID that is unique. CustomerDate.CustomerID = CustomerReferal.ReferredByID I am importing the Customer Data first. I need to have the custom object Customer Referrals become a child of the Account (or Customer Data object). I will not know the SalesForce id when the data is imported. I need to make the list of customers referred by a particular customer available in the Account screen. What is the best method to use to accomplish this? Thanks, Samyra Samyra Chrisp Application Engineer [cid:image002.png@01CD0680.0FCD0F50] All Covered - IT Services from Konica Minolta www.AllCovered.com 1431 Greenway Drive, Suite 200 Dallas, TX 75038 Mobile: 214.686.0618 Email: schrisp@AllCovered.com [LinkedIn][Twitter][FaceBook]
Hargobind_SinghHargobind_Singh
Hi Samyra, 

So if I understand it correctly, you are importing customers first, and then want to import customer referrals, and since you don't have salesforce IDs, it is hard to connect.

And that is where the concept of "External ID" comes in. Salesforce has created external ID system for data-imports where you have related data outside of the system and want to import it. 

I'm sure you would have some conncted field, e.g.  customer number which exists in both tables, you can tell salesforce to use that field to connect your records, and salesforce would go ahead and fill up the lookups for you. I suggest you read through the concept of external IDs and see if that resolves your problem. 

Apologies if I am totally off track with my answer.. 
 
This was selected as the best answer