monaco-editor/test/samples/sample.apex.txt
2020-09-21 12:18:52 +02: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.');
}