I have two custom objects with Master Detail relationship. I need to be able to bulk upsert these records simultaneously. For example:
If the master records don't exist, create them. Otherwise, create them. If detail records don't exist for these master records, create them. Otherwise, update them.
The master object has only two fields: One text field and one checkbox. The detail object has only one additional field that is a checkbox.
In other words, master records and their related detail records may or may not exist. I need to be able to create either single master records or multiple master records (along with their detail records).
I tried to do some research and found this.
This solution is using an external field and that seems to be the right way to go. However, I don't understand how to bulkify the code.
Any help you can provide is appreciated. Let me know if you need more information.
Thank you.