Created
February 22, 2014 18:58
-
-
Save tyoshikawa1106/9160095 to your computer and use it in GitHub Desktop.
Apexトリガーで使えるエラー判定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Update処理 | |
List<Database.Saveresult> results = Database.Update(accounts, false); | |
// Errorレコード判定 | |
Integer i = 0; | |
for (Database.SaveResult sr : results) { | |
if(!sr.isSuccess()) { | |
Database.Error err = sr.getErrors()[0]; | |
contactMap.get(accounts[i].Id).addError( | |
err.getMessage() | |
); | |
} | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment