Reputation: 39
I created a custom field on Item Fulfillment with the field type Rich Text. I entered the following HTML content into the field:
<p><strong>Special Offer:</strong> Get 20% off this month!</p>
Now, I am trying to access and render this field in an Advanced PDF/HTML Template using the following code:
<table class="monthlyPromo">
<tr>
<td>
<#if record.custbody_monthly_promo?has_content>
<#assign myhtml = record.custbody_monthly_promo?interpret>
<@myhtml>
</#if>
</td>
</tr>
</table>
However, the content from the custom field is not being displayed on the PDF. It shows as blank when the PDF is generated.
What I Have Tried: Confirmed that the custom field custbody_monthly_promo is correctly populated with HTML content. Used ${record.custbody_monthly_promo} to check if the raw HTML is being retrieved — it shows the raw tags (like
and ) but doesn’t render them. Verified that the field ID custbody_monthly_promo is correct. Desired Outcome: I want to render the HTML content stored in the Rich Text field directly in the PDF as formatted text (e.g., Special Offer: Get 20% off this month!) without displaying the raw HTML tags.
Question: How can I interpret and render the HTML content from a custom Rich Text field in a NetSuite Advanced PDF/HTML Template?
Upvotes: 1
Views: 47
Reputation: 8857
I don't think you need any special tricks for this. Just rendering the raw value from the Rich Text field renders correctly in my account:
The contents of my Rich Text field (custentity11
):
<p><strong>Special Offer:</strong> Get 20% off this month!</p>
The contents of my template:
<h1>Hello World</h1>
<hr />
<p>${record.custentity11}</p>
<hr />
I'm not sure an @
directive is necessary at all.
If that's still not working for you, and ?interpret
doesn't work, you could try using ?no_esc or ?html (deprecated) on the value as well.
Upvotes: 2