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
Juan Rafael Motta Velasco 4Juan Rafael Motta Velasco 4 

How can I populate a master-detail field ?

Hello, good morning everyone.

Could you help? I created a field related to the account object and I want to fill in autometico when creating a record by Dataloader, the CSV file only contains the customer number, but not the account name (Account)

I have tried to populate that field by Process Builder, but I do not start as, the other option is to do a trigger, which as soon as the CSV is loaded, it will be triggered and compare "Customer Number" of my custom object against "Client Number" (Accounts) and if it is the same, fill in the field Master-detail, in my custom object. Do you have any idea how to do this trigger?

Look out for comments.User-added image
Shashikant SharmaShashikant Sharma
Hi Juan,

There are two ways for you here:

1. If it is one time load then you could easily use VLookup functiona of excel and use it to map salesforce Account Ids load the data.
Steps:
a .Export All Accounts with Number and Id
b. In your csv create new column for AccountId and use VLookup function to populate it from Number
c. Upload the modfied csv

2. Before insert trigger on Account, you could start with these and ask questions as you face issues.
http://forceschool.blogspot.in/search/label/Apex%20Triggers
http://www.sfdc99.com/beginner-tutorials/

Thanks
Shashikant