monaco-editor/monaco-editor/test/samples/sample.apex.txt
2021-11-05 11:59:13 +01:00

7 lines
362 B
Text

/* Using a single database query, find all the leads in
the database that have the same email address as any
of the leads being inserted or updated. */
for (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) {
Lead newLead = leadMap.get(lead.Email);
newLead.Email.addError('A lead with this email address already exists.');
}