Hello VanderMental,
Is this a one time operation or a recurring task? If this is a one time operation, is performance really a concern?
you can split the job into two batches - one to create all the accounts and another to create 4x contacts for the accounts created in first batch.
Also please note that no two guids are same so your condition "entity.Id
== new Guid()" will always return false. What you would like to do is
entity.Id != Guid.Empty I guess.
you can also change the entity.Id
== null into entity.Id
== Guid.Empty
If you want to do it in single batch, you could generate new guids and create accounts by assigning this new guid as account id, and use the same account id to create contacts
the drawback with above approach is that CRM has built in function to generate sequential guids to make indexing faster. once you generate your own ids, you will not have that benefit.
So please consider all these facts before creating the data.
Regards,
Jithesh