NetSuite Advanced PDF/HTML - 显示自定义字段中带有 URL 的图像

NetSuite Advanced PDF/HTML - Displaying images with URL from custom field

我正在尝试创建一个高级 PDF/HTML 模板,该模板将使用自定义字段中的 URL 显示图像。自定义字段是超链接,字段ID为{custitem_dp_image1}。我正在使用图像标签并将 {custitem_dp_image1} 字段引用为 src 但由于以下错误我无法保存模板:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0 java.lang.InternalError: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

我也试过下面的代码:

<#if result.custitem_dp_image1?length != 0><img src="${result.custitem_dp_image1}" style="width: 100px; height: 100px;" /> </#if>

但是当我尝试从保存的搜索查看高级 PDF/HTML 模板时收到以下错误:

The template cannot be saved due to the following errors: org.xml.sax.SAXParseException; lineNumber: 53; columnNumber: 28; The value of attribute "src" associated with an element type "img" must not contain the '<' character.

*The template was stored as invalid.

如何让它工作并显示图像?

为您的自定义字段使用图像数据类型而不是超链接。

解决方案是将自定义字段更改为 type = Free-Form Text 并使用以下 freemarker 代码:

<#if result.custitem_dp_image1?length != 0><img src="${result.custitem_dp_image1}" style="width: 100px; height: 100px;" /> </#if>

您还可以使用工作流将 Hyperlink 自定义字段link 转换为选中存储值字段的自由格式文本字段。

在 SuiteAnswers ID 下查找:89195