将外部 Suitelet URL 放入 QR 码的 value 属性时出错。 NetSuite

问题描述 投票:0回答:2

我正在尝试从我的 PDF suitelet 脚本访问外部 suitelet(PDF),我有一个 QRcode 标签来访问该外部 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" />

每当我将其 URL 放入二维码标签时,系统都会给出错误。如果我只是尝试在 value 属性中放置一个普通的 Web 链接,它就可以正常工作。显示了 QRcode,但是当我输入外部 suitelet URL 时,脚本给出以下错误:

{"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}

外部 suitelet 的 URL 工作正常,但是当尝试从 QRcode 访问它时,就会出现错误。

netsuite qr-code suitescript suitescript2.0
2个回答
1
投票

您的条形码 URL 中包含

&deploy
作为 URL 参数。 PDF 生成器中的 XML 解析器将其识别为格式错误的 XML 实体(始终以与号 (&) 开头并以分号 (;) 结尾。您可以通过将与号替换为 XML 实体来修复此问题。 & 符号 -
&amp;
.

所以将

&deploy
更改为
&amp;deploy
。您还需要对 URL 中的任何其他参数执行相同的操作(例如:
&compid
>
&amp;compid
)。


0
投票

使用encodeURI和encodeURIComponent对统一资源标识符(URI)进行编码,方法是将某些字符替换为表示字符的UTF-8编码的一个、两个、三个或四个转义序列。

-TO,让它发生!

© www.soinside.com 2019 - 2024. All rights reserved.