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
DesaiDesai 

External Id with upsert on Batch apex

Hi ,

We have two  independent objects ,
Object1 : Account  Data is stored from external system. It contains both parent and child accounts . Child records in Object1 will have external Id of parent.
Account : Data from Object1 should be upserted in Account.

So , in execute method, we are first getitng the parent Accounts and storing it in map and then child accounts in another map.

But to associate the child account to parent we need either SF Id or External id. How do we use external Id as there is no relationship b/w Account and Object1.

We went throught these links but there is relationship b/w two objects.
https://salesforce.stackexchange.com/questions/220184/updating-a-records-using-external-id-in-apex
https://www.sfdcstuff.com/2017/04/using-databaseupsert-with-external-id.html
https://wdcigroup.net/salesforce-tip-creating-salesforce-parent-record-and-child-record-with-reference-key-cascading-insert/

Regards,
Desai