経営陣は、年間売上高が100万ドルを超える取引先に対して商談を自動的に作成するよう依頼しました。開発者は、この要件を満たすために、取引先オブジェクトに次のトリガを作成しました。 for (Account a : Trigger.new) { if (a.AnnualRevenue > 1000000) { List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE AccountId = :a.Id]; if (oppList.size() == 0) { Opportunity oppty = new Opportunity(Name = a.Name, StageName = 'Prospecting', CloseDate = System. today().addDays(30)); insert oppty; } } } ユーザーはUIから取引先レコードを更新でき、年間売上高の高い取引先向けに作成された商談を確認できます。しかし、管理者がデータローダーを使用して179件の取引先リストをアップロードしようとすると、システム例外エラーが発生し、アップロードに失敗します。 上記のコード セグメントを修正するために開発者が実行する必要がある 2 つのアクションはどれですか。 2つの答えを選択してください
正解:A,C
This is a classicbulkification problem, covered under"Apex Development Best Practices"in the PD1 guide. Reference:Apex Developer Guide - Bulk Design Patterns D (Correct):DML operations (like insert) in a loop can cause theDML 151 limiterror. Moving them outside the loop and collecting records in a list before performing a single DML operation is best practice.Reference: Salesforce Platform Developer I Study Guide - Process Automation and Logic (30%)