ANS-1833 · SUITESCRIPT DEVELOPMENT
How to Display HTML Content or Links in NetSuite Sublists?
Utilize the 'text' field type in SuiteScript to embed interactive HTML content and links directly within NetSuite sublist lines.
Short answer
The 'inlinehtml' field type is not supported in NetSuite sublists. As a workaround, use the 'text' field type and populate it with HTML content, such as `<a>` tags for links or buttons. This allows for dynamic, interactive elements directly on sublist lines in Suitelets.
Scenario
Developers often encounter limitations when attempting to display rich HTML content or interactive elements, such as view/edit buttons, directly within sublist lines in NetSuite Suitelets. The 'inlinehtml' field type, while available for other contexts, is not supported for sublists, requiring an alternative method to achieve desired UI functionality.
Solution
The 'inlinehtml' field type is not supported in NetSuite sublists. A common workaround is to utilize the 'text' field type to display HTML content, such as clickable links or buttons. This approach is particularly useful in Suitelets where a sublist displays items, and each line requires interactive elements for viewing or editing.
To implement this workaround:n
Create your sublist (e.g.,
subListOrders).nAdd the desired columns to the sublist using the 'text' field type. For example, to add 'View' and 'Edit' columns:n
nvar columnView = subListOrders.addField({n id: 'custpage_sublist_so_view',n type: serverWidget.FieldType.TEXT,n label: 'View'n});nvar columnEdit = subListOrders.addField({n id: 'custpage_sublist_so_edit',n type: serverWidget.FieldType.TEXT,n label: 'Edit'n});nn
When populating the sublist, set the value of these 'text' fields with the desired HTML, such as an
tag for a button or link. TheVIEW_LINKandEDIT_LINKvariables can be dynamically set to direct users to the appropriate NetSuite page, another Suitelet, or an external URL.n
nsubListOrders.setSublistValue({n id: 'custpage_sublist_so_view',n line: i,n value: '<a href="VIEW_LINK">View</a>'n});nsubListOrders.setSublistValue({n id: 'custpage_sublist_so_edit',n line: i,n value: '<a href="EDIT_LINK">Edit</a>'n});nExpert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
