SUMMARY: Just because something looks like a bug doesn’t mean it needs a fix; sometimes, gracefully handling the error is more than enough.
A few days ago, Isabella contacted me: The Knowledge Article Export PDF app needs to be fixed. Nothing is working, no error message, nothing. Fix IT!
Isabella did an excellent job debugging, but a bug stopped the app from working, and no PDFs were created. She followed the installation guide, tested with different Users, and even tried another browser. Nothing fixed the issue.
After some peer-debugging, we noticed the first Field in the Field Set was the Created Date. Our hunch was correct that Created Date caused the problem.
The first Field sets the File Name of the PDF. So far, I only designed the code to handle text Fields as the first Field, not any other type.
My first reaction was to add Date Field Type support; after some tinkering, I noticed how much effort that would be.
Thinking about it for a while, I noticed: It makes no sense to have the first Field to be set as something other than Text. None of my customers ever reported that bug.
Even for Isabella, it was only as part of the test, not because the Created Date should be the first Field.
Instead of adding a complex type conversion, I added an error message “The first Field in the Field Set must be a Text Field.”
That error message is the better solution. It handles the error gracefully while keeping the code clean and simple.
In case some customer ever needs to have a Field other than Text as the File Name, I will think about a solution.