You need to sign in to do that
Don't have an account?
Andrew Morales 1
Creating Many to Many Relationships from a CSV
Hello!
I created the schema below with (two) Master Detail Fields on the Junction-Object-AB pointing to both A and B. I believe the schema is sound for my application since this is a Many to Many relationship.
Schema:
Standard Object A
Custom Object B
Junction Object AB
My question is related to uploading the data via csv. The data is coming from an internal database and each record has a unique ID (unique to the table) already so I dont have to worry about pulling back the SFDC ID after upload from the success file.
Where I am stuck is - on object B, within one record/line I have multiple record ID's in one cell pointing to the data in Object A. So an example would be:
Object A - Developer Contact
-- Tom Jones - ID - 1
-- Johnny Depp - ID - 2
-- Christina Aguilera - ID - 3
Object B - Applications
-- Angry Birds - Dev ID - 1,2,3
-- Tetris - Dev ID - 2,3
So I would need to create 3 junction records for Angry Birds and 2 junction records for Tetris based on the Developers that worked on them.
QUESTIONS
How can I create the junction records if all the ID's are in one cell?
Can I manipulate the data within CSV and then upload?
Do all the ID's have to be loaded in a custiom field and it has to be done Programatically?
I will be working with about 30K records for Object A and 30K for object B so this cannot be done manually. I would appreciate any suggestions and/or pointing me to some help articles so I can work through it.
THANK YOU!!!
I created the schema below with (two) Master Detail Fields on the Junction-Object-AB pointing to both A and B. I believe the schema is sound for my application since this is a Many to Many relationship.
Schema:
Standard Object A
Custom Object B
Junction Object AB
My question is related to uploading the data via csv. The data is coming from an internal database and each record has a unique ID (unique to the table) already so I dont have to worry about pulling back the SFDC ID after upload from the success file.
Where I am stuck is - on object B, within one record/line I have multiple record ID's in one cell pointing to the data in Object A. So an example would be:
Object A - Developer Contact
-- Tom Jones - ID - 1
-- Johnny Depp - ID - 2
-- Christina Aguilera - ID - 3
Object B - Applications
-- Angry Birds - Dev ID - 1,2,3
-- Tetris - Dev ID - 2,3
So I would need to create 3 junction records for Angry Birds and 2 junction records for Tetris based on the Developers that worked on them.
QUESTIONS
How can I create the junction records if all the ID's are in one cell?
Can I manipulate the data within CSV and then upload?
Do all the ID's have to be loaded in a custiom field and it has to be done Programatically?
I will be working with about 30K records for Object A and 30K for object B so this cannot be done manually. I would appreciate any suggestions and/or pointing me to some help articles so I can work through it.
THANK YOU!!!
Please use the below trigger:
Please follow the solution provided in other post:
https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000DDQvIAO
Please do let me know if it helps you.
Regards,
Mahesh
All Answers
You can achieve this by using the trigger on second object and create the junction object records accordingly based on the comma separed values to iterate and prepare the combinations and insert into Junction object.
Please do let me know if it helps you.
Regards,
Mahesh
Please use the below trigger:
Please follow the solution provided in other post:
https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000DDQvIAO
Please do let me know if it helps you.
Regards,
Mahesh