Duplicate Error Logs as rendered through Data.com Administration > Duplicate Management > Duplicate Error Logs are truncated around 250 characters. Is there anywhere else to view these completely? I have Apex triggers on Duplicate Record Item, but since they're executed as the Automated Process user, debug output isn't logged to standard error logs, and writing to a custom debug object fails since all actions are rolled back when there's an error.
1 Answer
This workaround doesn't explicitly answer my question and may only be applicable to a dev environment in which you don't care to throw an exception, but it solves the immediate problem of not being able to see the error message in its entirety.
I just did away with throwing an exception and then wrote to my custom error log.
(In my case, I did not want to rollback anything, but if I did, I'd make use of System.savePoint and Database.rollback. I gleaned inspiration for this workaround from Can I prevent an insert to be rolled back even if my class (later) runs into an exception?)
Before
try { <my DML statement> } catch (DmlException e) { myCustomErrorService.createErrorRecord(e.getMessage()); throw new Exception(e.getMessage()); }
After
String errorMessage; try { <my DML statement> catch (DmlException e) { errorMessage = (e.getMessage()); } finally { myCustomErrorService.createErrorRecord(errorMessage); }
-
More context (specific error irrelevant here but this illustrates the problem): Before, in Duplicate Error Log:
Merge failed. First exception on row 0 with id ...; first error: INVALI_
Now able to log to my custom error object, I can see the full error and proceed in debugging._Merge failed. First exception on row 0 with id...; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: CreatedDate, LastModifiedDate. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [CreatedDate, LastModifiedDate_
Aug 22, 2016 at 17:07