Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Created February 22, 2014 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyoshikawa1106/9160095 to your computer and use it in GitHub Desktop.
Save tyoshikawa1106/9160095 to your computer and use it in GitHub Desktop.
Apexトリガーで使えるエラー判定
// 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