All, when getting the value of a multiselect field...
# suitescript
d
All, when getting the value of a multiselect field (in the post) of a Suitelet, the comma is represented by
\u0005
. I use replace(/[\u0005]/g, ',') ... but its not 100% reliable. Anyone else out there have a better solution?
s
my first reaction would be - use a SPA instead. realizing that may not be exciting to you, have you considered just parsing it by that unicode character directly rather than transforming it to be commas? Even so, can you shed light on how it's not 100% reliable?
d
SPA?
We'll, for the reliable piece ... we test our SuiteApps in several accounts (QA/DEV) x OneWorld, NonOneWorld. Out of the 6 accounts we test on, only one shows this error
s
What is the error?
d
You have entered an Invalid Field Value 4\u00057\u00053 for the following field
What's most frustrating is ... the is what I'm setting the field to ["4","7","3"]
s
by SPA I mean a single page app. I think NetSuite's UI building functionality is technically lame. In this case I'd consider a small app built with your framework of choice (or no framework) using traditional web tech. In which case NS just becomes a data backend, and you can send that multiselect as a standard json array of values [4,7,3] without any funky conversion at all.
j
@stalbert with you on SPA. Wonder how this technique is viewed under the “Built for Netsuite” program
s
There are BFN apps that iframe in stuff from their own web servers
what I'm talking about typically is hosted in the NS file cabinet, so it's 'closer' to NS than those other solutions that seem to be approved.
e
The solution to parsing a string is a SPA?
For multiselect I generally do
multiselectValue.split("\x05")
to get the Array of values
s
The solution to avoiding the entire headache of UI Suitelets
😂 1
s
This may sound like an overly simple answer but try using single quotes rather then double ?