Can't use "$publicNotes" in design theme

Hi folks,

I cannot use the field $publicNotes in my custom design, because the creation of the PDF fails if there is an newline in the “public_notes” field. Do you think this is a bug I should report or am I wrong?

The error message says:

The specified value "!" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers."

(Of course I double checked that there is no error in my color formats).

Directly after that error another error occurs which I guess is “the real one”:

edit:1 Uncaught SyntaxError: Unexpected token
in JSON at position 9575

When I click on the message in the debug console of chrome it shows my pre-parsed JSON for pdfmake, and moans the line break in the public_notes field.

Any ideas how I can fix this? The weird thing is that I can use the variable $notesAndTerms without any problems even with line breaks… :-/


Try $client.publicNotes

Hm, when I change to $client.publicNotes the PDF builds, but does not display the content of public_notes, so I guess this variable is empty.

I investigated on this issue and it turns out, that JSON does not support multiline fields. Every line break has to be escaped with \n. I would like to commit a fix for that, but I am not sure where to replace line-breaks with “\n”. Should it be replaced when the field is saved or just before the PDF gets generated.

Is that even the right place to mention that or should I open an issue on github?

I’m sorry, I was wrong earlier. The variable should be $publicNotes not $client.publicNotes.

I’m not sure on the best way to fix it, if you’re able to get it working we’d definitely accept a pull request.