I have an apex class that implements SandboxPostCopy, and runs every time we create a sandbox. in that process we insert sample data from a few static resources, one static resource for each record: Account, Opportunity, Contact, Lead
This part of the script looks like this:
insertRecords('Account','SandboxManagement_SampleData_Account_PartnerRT');
insertRecords('Lead','SandboxManagement_SampleData_Lead');
insertRecords('Contact','SandboxManagement_SampleData_Contact');
The problem is whenever it runs, i receive the error Too Many SOQL Queries, because all of the triggers are fired.
How can i overcome this issue? i thought about chaining Queueable jobs for each record, but feels like there is a better solution i am missing.