Marty Zigman Marty Zigman
Prolecto Labs Accelerator Templates

Watch your Braces: NetSuite Handling Rules for HTML SuiteScript Developers

NetSuite Technical

Tags: , ,

This article is relevant if you are producing software development work with NetSuite and you need to handle HTML encoding and decoding rules.

Background

Our Content Renderer Engine (CRE) has now been put to use in multiple complex client situations.  Not only can we transform multiple linked saved searches into a NetSuite Advanced PDF template, we can transform the search result sets to feed data to Email Recipients, Subject, Message Body, and Document Names using template markup.  We (and you, if you ask and have a real problem to solve) can now get to that hard to reach NetSuite data and then use it distribute and render meaningful content.

In our built-in CRE SuiteLet tester, we solve one of the other common challenges: the back and forth of development retrieving your data, and your template markup, and assessing the melding of the two.  Yet, it is so easy to become accustom to think what you are seeing on screen is what you are actually working with.  And thus we, the Prolecto team, were fooled and frustrated by NetSuite’s automatic handling of  HTML braces encoding.

NetSuite Stores HTML Braces Encoded

The key to understand what is going on is that input forms in NetSuite are effectively HTML input element depending on the type.  I created an experiment to ground my interpretations.  I wrote a small JavaScript program to output the symbols for the common characters used in work we do.  I then created three types of text input fields:

  • Free Form Text
  • Text Area
  • Long Text
NetSuite will take data that is stored in Free Form Text and Text Area and encode the  left brace (<) and the right brace (>) as (&lt;) and (&gt;) respectively.   It won’t do that with a Long Text field.  See image of the results of my experiment.  No matter which element used, when those characters render to you on screen, they will show up as the familiar braces.  This encoding and decoding becomes transparent especially because most of the NetSuite work we are doing is effectively rendering HTML.

If you need to work with the strings in your application exactly as you expect (don’t we all), you can use some simple JavaScript to decode anything NetSuite automatically encoded:

input = String(input).replace(/&lt;/g, '<').replace(/&gt;/g, '>');

NetSuite Ampersands Appear Spared

While I share this, the general HTML community knows that the three many characters to worry about are the “<“, “>” and “&”.  Yet, NetSuite does not appear, from my testing, to take an ampersand  (&) and turn it into “&amp;” back at the database.

Work with NetSuite Experts

If you believe, as I do, that the NetSuite platform is just amazing in terms of how it can be used to solve business problems, and you want to be part of team that holds high standards for care and ethics while demonstrating your earned expertise and superior client leadership, perhaps we should have a conversation.

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

One thought on “Watch your Braces: NetSuite Handling Rules for HTML SuiteScript Developers

Leave a Reply

Your email address will not be published. Required fields are marked *