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
SFDC_BigDogSFDC_BigDog 

many to many for Bulk records

I have created two custom objects (A and B)and a junction object(AB). i.e. Both A and B have Many to Many relationship. Now I need to insert 5000 records. How can I automatically populate the relation in Junction object. DO I have to write any trigger or Do I have to do Manually mapping the records?

 
Best Answer chosen by SFDC_BigDog
BalajiRanganathanBalajiRanganathan
I think you need to follow this order

1) Insert the records in Object A
2) Insert the records in Object B
3) Create a new csv file to have the ids from both Object A and B by using the success result (from above 2 operations)
4) Insert into object AB using this new CSV file.

All Answers

BalajiRanganathanBalajiRanganathan
I think you need to follow this order

1) Insert the records in Object A
2) Insert the records in Object B
3) Create a new csv file to have the ids from both Object A and B by using the success result (from above 2 operations)
4) Insert into object AB using this new CSV file.
This was selected as the best answer
SFDC_BigDogSFDC_BigDog
Hello @balajiRanganathan

Thank you for the prompt reply. I have a doubt. Do I have to take all the ids from the two insert operations and do I have to insert into junction obect.?
BalajiRanganathanBalajiRanganathan
yes. probly you have to make sure that the association is correct( between the ids)
SFDC_BigDogSFDC_BigDog
Thank you BalajiRanganathan.