douglascayers / sfdc-convert-notes-to-chatter-notes

📓 Easily migrate your Notes to Enhanced Notes.
https://douglascayers.com/2017/05/08/convert-notes-to-enhanced-notes/
BSD 3-Clause "New" or "Revised" License
26 stars 11 forks source link

Try to decipher System Error Codes #11

Closed douglascayers closed 7 years ago

douglascayers commented 7 years ago

When the batch job fails to convert due to:

Note cant be saved because it contains HTML tags or unescaped characters that are not allowed in a Note.

The system generated apex exception email for the managed package only says:

Salesforce System Error: 623811003-63707 (123133497) (123133497)

I'm not sure if this error code always means this reason, but if so perhaps try to capture this error code so a meaningful message can be added to the log record.

williamtreasure commented 7 years ago

This app solves a real problem so thank you. I am having the below issue.

Batch is sometimes failing due to:

Salesforce System Error: 143453867-104393 (123133497) (123133497)

I have a hunch this is due to the above stated:

Note cant be saved because it contains HTML tags or unescaped characters that are not allowed in a Note.

It would be a great feature to log these Notes as failed and move on. Right now it is failing the whole Batch Job.

douglascayers commented 7 years ago

Hi @williamtreasure,

Thanks for the feedback =)

I'll see what can be done about partial saves, but it's a bit tricky since the code bulk saves the ContentNotes and then shares with ContentDocumentLinks. Might get messy trying to unravel where the new note got saved but failed to share it out -- what should happen in that situation? Keep note converted but unshared?

douglascayers commented 7 years ago

Unfortunately, Apex cannot catch the Salesforce System Error. The error occurs and forces the application to terminate. Do not pass Go, do not collect $200.

I am working on improving the special character encoding. The best thing right now is as you identify notes that won't convert, please let me know which special characters were causing the problem.

For example, we now know that © is not supported to has to be replaced with © (next release will handle it).

Thanks