Skip to content

Instantly share code, notes, and snippets.

@justindonnaruma
Last active February 26, 2020 14:01
Show Gist options
  • Save justindonnaruma/222f1bbd0b0ff6561bfd18db793532d2 to your computer and use it in GitHub Desktop.
Save justindonnaruma/222f1bbd0b0ff6561bfd18db793532d2 to your computer and use it in GitHub Desktop.
Salesforce Snippets
try {
insert object;
} catch (System.DmlException e) {
System.debug('DML-DEBUG');
System.debug('DML-DEBUG - Cause: '+e.getCause());
System.debug('DML-DEBUG - LineNum: '+e.getLineNumber());
System.debug('DML-DEBUG - Message: '+e.getMessage());
System.debug('DML-DEBUG');
for (Integer i = 0; i < e.getNumDml(); i++) {
System.debug('DML-Debug - Line '+1+': '+e.getDmlMessage(i));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment