Search code examples
netsuiteqr-codesuitescriptsuitescript2.0

Error while putting a External Suitelet URL in value property of QR Code. NetSuite


I am trying to access an external suitelet(PDF) from my PDF suitelet script, i have a QRcode tag to access that External SuiteLet.

<barcode width="120px" height="100px" codetype="qrcode" showtext="true" value="https://4654954.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=507&deploy=1&compid=4654954&h=9013fc6d58590a5ccc26" />

Whenever i put its URL in the QR code tag, system gives me error. If i simply try to put a normal web link in the value property, it works fine. The QRcode displays but when i put the external suitelet URL, the script gives following error:

{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Error Parsing XML: The reference to entity \"deploy\" must end with the ';' delimiter.","id":"","stack":["createError(N/error)","onRequest(/SuiteScripts/ar_sample_pdf.js:99)"],"cause":{"type":"internal error","code":"USER_ERROR","details":"Error Parsing XML: The reference to entity \"deploy\" must end with the ';' delimiter.","userEvent":null,"stackTrace":["createError(N/error)","onRequest(/SuiteScripts/ar_sample_pdf.js:99)"],"notifyOff":false},"notifyOff":false,"userFacing":false}

The external suitelet's URL is working fine, but when its tried to be accessed from QRcode the error arises.


Solution

  • Your barcode URL has &deploy in it as a URL parameter. The XML parser at the PDF generator is recognizing this as a malformed XML entity (which always start with an ampersand (&) and end with a semi-colon (;). You can fix this by replacing the ampersand with the XML entity for the ampersand - &amp;.

    So change &deploy to &amp;deploy. You will also need to do the same thing for any other parameters in the URL (eg: &compid > &amp;compid).